@deephaven/iris-grid 0.62.0 → 0.62.1-beta.1
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/dist/mousehandlers/IrisGridContextMenuHandler.css +5 -0
- package/dist/mousehandlers/IrisGridContextMenuHandler.css.map +1 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts +5 -4
- package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts.map +1 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.js +283 -163
- package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -1
- package/package.json +16 -16
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
7
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -9,10 +11,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
9
11
|
import { dhFilterFilled, vsRemove, vsCheck, vsFilter } from '@deephaven/icons';
|
|
10
12
|
import debounce from 'lodash.debounce';
|
|
11
13
|
import { ContextActions, ContextActionUtils, GLOBAL_SHORTCUTS } from '@deephaven/components';
|
|
12
|
-
import { GridMouseHandler, GridRenderer, isEditableGridModel, isExpandableGridModel } from '@deephaven/grid';
|
|
14
|
+
import { GridMouseHandler, GridRange, GridRenderer, isEditableGridModel, isExpandableGridModel } from '@deephaven/grid';
|
|
13
15
|
import { TableColumnFormatter, DateTimeColumnFormatter, TableUtils } from '@deephaven/jsapi-utils';
|
|
14
16
|
import Log from '@deephaven/log';
|
|
15
|
-
import { assertNotNull, copyToClipboard } from '@deephaven/utils';
|
|
17
|
+
import { TextUtils, assertNotEmpty, assertNotNaN, assertNotNull, copyToClipboard } from '@deephaven/utils';
|
|
16
18
|
import { DateTimeFormatContextMenu, DecimalFormatContextMenu, IntegerFormatContextMenu } from "../format-context-menus/index.js";
|
|
17
19
|
import "./IrisGridContextMenuHandler.css";
|
|
18
20
|
import SHORTCUTS from "../IrisGridShortcuts.js";
|
|
@@ -21,6 +23,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
23
|
var log = Log.module('IrisGridContextMenuHandler');
|
|
22
24
|
var DEBOUNCE_UPDATE_FORMAT = 150;
|
|
23
25
|
var CONTEXT_MENU_DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS';
|
|
26
|
+
var MAX_MULTISELECT_ROWS = 1000;
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
29
|
* Used to eat the mouse event in the bottom right corner of the scroll bar
|
|
@@ -255,7 +258,6 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
255
258
|
}
|
|
256
259
|
getCellActions(modelColumn, grid, gridPoint) {
|
|
257
260
|
var {
|
|
258
|
-
dh,
|
|
259
261
|
irisGrid
|
|
260
262
|
} = this;
|
|
261
263
|
var {
|
|
@@ -277,120 +279,14 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
277
279
|
row: sourceRow
|
|
278
280
|
} = sourceCell;
|
|
279
281
|
var value = model.valueForCell(sourceColumn, sourceRow);
|
|
280
|
-
var valueText = model.textForCell(sourceColumn, sourceRow);
|
|
281
282
|
var column = columns[sourceColumn];
|
|
282
283
|
var actions = [];
|
|
283
|
-
var {
|
|
284
|
-
quickFilters
|
|
285
|
-
} = irisGrid.state;
|
|
286
284
|
var theme = irisGrid.getTheme();
|
|
287
285
|
var {
|
|
288
286
|
filterIconColor
|
|
289
287
|
} = theme;
|
|
290
|
-
var {
|
|
291
|
-
settings
|
|
292
|
-
} = irisGrid.props;
|
|
293
|
-
var dateFilterFormatter = new DateTimeColumnFormatter(dh, {
|
|
294
|
-
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone,
|
|
295
|
-
showTimeZone: false,
|
|
296
|
-
showTSeparator: true,
|
|
297
|
-
defaultDateTimeFormatString: CONTEXT_MENU_DATE_FORMAT
|
|
298
|
-
});
|
|
299
|
-
var previewFilterFormatter = new DateTimeColumnFormatter(dh, {
|
|
300
|
-
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone,
|
|
301
|
-
showTimeZone: settings === null || settings === void 0 ? void 0 : settings.showTimeZone,
|
|
302
|
-
showTSeparator: settings === null || settings === void 0 ? void 0 : settings.showTSeparator,
|
|
303
|
-
defaultDateTimeFormatString: CONTEXT_MENU_DATE_FORMAT
|
|
304
|
-
});
|
|
305
288
|
if (column == null || rowIndex == null) return actions;
|
|
306
289
|
|
|
307
|
-
// grid data area context menu options
|
|
308
|
-
if (model.isFilterable(sourceColumn)) {
|
|
309
|
-
// cell data area contextmenu options
|
|
310
|
-
var filterMenu = {
|
|
311
|
-
title: 'Filter by Value',
|
|
312
|
-
icon: vsRemove,
|
|
313
|
-
iconColor: filterIconColor,
|
|
314
|
-
group: IrisGridContextMenuHandler.GROUP_FILTER,
|
|
315
|
-
order: 10,
|
|
316
|
-
actions: []
|
|
317
|
-
};
|
|
318
|
-
if (value == null) {
|
|
319
|
-
// null gets a special menu
|
|
320
|
-
if (quickFilters.get(sourceColumn)) {
|
|
321
|
-
filterMenu.actions.push({
|
|
322
|
-
title: 'And',
|
|
323
|
-
actions: this.nullFilterActions(column, quickFilters.get(sourceColumn), '&&'),
|
|
324
|
-
order: 2,
|
|
325
|
-
group: ContextActions.groups.high
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
filterMenu.actions.push(...this.nullFilterActions(column));
|
|
329
|
-
} else if (value === '') {
|
|
330
|
-
// empty string gets a special menu
|
|
331
|
-
if (quickFilters.get(sourceColumn)) {
|
|
332
|
-
filterMenu.actions.push({
|
|
333
|
-
title: 'And',
|
|
334
|
-
actions: this.emptyStringFilterActions(column, quickFilters.get(sourceColumn), '&&'),
|
|
335
|
-
order: 2,
|
|
336
|
-
group: ContextActions.groups.high
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
filterMenu.actions.push(...this.emptyStringFilterActions(column));
|
|
340
|
-
} else if (TableUtils.isBooleanType(column.type)) {
|
|
341
|
-
// boolean should have OR condition, and handles it's own null menu options
|
|
342
|
-
if (quickFilters.get(sourceColumn)) {
|
|
343
|
-
filterMenu.actions.push({
|
|
344
|
-
title: 'Or',
|
|
345
|
-
actions: this.booleanFilterActions(column, valueText, quickFilters.get(sourceColumn), '||'),
|
|
346
|
-
order: 2,
|
|
347
|
-
group: ContextActions.groups.high
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
filterMenu.actions.push(...this.booleanFilterActions(column, valueText));
|
|
351
|
-
} else if (TableUtils.isNumberType(column.type) || TableUtils.isCharType(column.type)) {
|
|
352
|
-
// Chars get treated like numbers in terms of which filters are available
|
|
353
|
-
assertNotNull(sourceColumn);
|
|
354
|
-
// We want to show the full unformatted value if it's a number, so user knows which value they are matching
|
|
355
|
-
// If it's a Char we just show the char
|
|
356
|
-
var numberValueText = TableUtils.isCharType(column.type) ? String.fromCharCode(value) : "".concat(value);
|
|
357
|
-
if (quickFilters.get(sourceColumn)) {
|
|
358
|
-
filterMenu.actions.push({
|
|
359
|
-
title: 'And',
|
|
360
|
-
actions: this.numberFilterActions(column, numberValueText, value, quickFilters.get(sourceColumn), '&&'),
|
|
361
|
-
order: 2,
|
|
362
|
-
group: ContextActions.groups.high
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
filterMenu.actions.push(...this.numberFilterActions(column, numberValueText, value, quickFilters.get(sourceColumn)));
|
|
366
|
-
} else if (TableUtils.isDateType(column.type)) {
|
|
367
|
-
var dateValueText = dateFilterFormatter.format(value);
|
|
368
|
-
var previewValue = previewFilterFormatter.format(value);
|
|
369
|
-
if (quickFilters.get(sourceColumn)) {
|
|
370
|
-
filterMenu.actions.push({
|
|
371
|
-
title: 'And',
|
|
372
|
-
actions: this.dateFilterActions(column, dateValueText, previewValue, value, quickFilters.get(sourceColumn), '&&'),
|
|
373
|
-
order: 2,
|
|
374
|
-
group: ContextActions.groups.high
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
filterMenu.actions.push(...this.dateFilterActions(column, dateValueText, previewValue, value, quickFilters.get(sourceColumn)));
|
|
378
|
-
} else {
|
|
379
|
-
if (quickFilters.get(sourceColumn)) {
|
|
380
|
-
filterMenu.actions.push({
|
|
381
|
-
title: 'And',
|
|
382
|
-
actions: this.stringFilterActions(column, valueText, value, quickFilters.get(sourceColumn), '&&'),
|
|
383
|
-
order: 2,
|
|
384
|
-
group: ContextActions.groups.high
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
filterMenu.actions.push(...this.stringFilterActions(column, valueText, value));
|
|
388
|
-
}
|
|
389
|
-
if (filterMenu.actions != null && filterMenu.actions.length > 0) {
|
|
390
|
-
actions.push(filterMenu);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
290
|
// Expand/Collapse options
|
|
395
291
|
if (isExpandableGridModel(model) && model.isRowExpandable(sourceRow)) {
|
|
396
292
|
// If there are grouped columns, then it is a rollup
|
|
@@ -477,6 +373,197 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
477
373
|
return actions;
|
|
478
374
|
}
|
|
479
375
|
|
|
376
|
+
// moved out of getCellActions since snapshots are async
|
|
377
|
+
getCellFilterActions(modelColumn, grid, gridPoint) {
|
|
378
|
+
var _this = this;
|
|
379
|
+
return _asyncToGenerator(function* () {
|
|
380
|
+
var {
|
|
381
|
+
dh,
|
|
382
|
+
irisGrid
|
|
383
|
+
} = _this;
|
|
384
|
+
var {
|
|
385
|
+
row: rowIndex
|
|
386
|
+
} = gridPoint;
|
|
387
|
+
var {
|
|
388
|
+
model
|
|
389
|
+
} = irisGrid.props;
|
|
390
|
+
var {
|
|
391
|
+
columns
|
|
392
|
+
} = model;
|
|
393
|
+
var modelRow = irisGrid.getModelRow(rowIndex);
|
|
394
|
+
var {
|
|
395
|
+
getSelectedRanges
|
|
396
|
+
} = grid;
|
|
397
|
+
assertNotNull(modelRow);
|
|
398
|
+
var sourceCell = model.sourceForCell(modelColumn, modelRow);
|
|
399
|
+
var {
|
|
400
|
+
column: sourceColumn,
|
|
401
|
+
row: sourceRow
|
|
402
|
+
} = sourceCell;
|
|
403
|
+
var column = columns[sourceColumn];
|
|
404
|
+
if (column == null || rowIndex == null) return [];
|
|
405
|
+
if (!model.isFilterable(sourceColumn)) return [];
|
|
406
|
+
var {
|
|
407
|
+
quickFilters
|
|
408
|
+
} = irisGrid.state;
|
|
409
|
+
var theme = irisGrid.getTheme();
|
|
410
|
+
var {
|
|
411
|
+
filterIconColor
|
|
412
|
+
} = theme;
|
|
413
|
+
var {
|
|
414
|
+
settings
|
|
415
|
+
} = irisGrid.props;
|
|
416
|
+
var selectedRanges = [...getSelectedRanges()];
|
|
417
|
+
// no selected range (i.e. right clicked a cell without highlighting it)
|
|
418
|
+
// although GridSelectionMouseHandler does change selectedRanges, state isn't updated in
|
|
419
|
+
// time for getSelectedRanges to show the selected cell
|
|
420
|
+
if (selectedRanges.length === 0) {
|
|
421
|
+
selectedRanges.push(new GridRange(sourceColumn, sourceRow, sourceColumn, sourceRow));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// - this block truncates the selected ranges to MAX_MULTISELECT_ROWS rows
|
|
425
|
+
// - NOT first MAX_MULTISELECT_ROWS rows after the first row
|
|
426
|
+
// - NOT first MAX_MULTISELECT_ROWS unique values (prevent case where there are a small
|
|
427
|
+
// amount of values, but a large amount of rows with those values)
|
|
428
|
+
if (GridRange.containsCell(selectedRanges, sourceColumn, sourceRow)) {
|
|
429
|
+
var rowCount = GridRange.rowCount(selectedRanges);
|
|
430
|
+
while (rowCount > MAX_MULTISELECT_ROWS) {
|
|
431
|
+
var lastRow = selectedRanges.pop();
|
|
432
|
+
// should never occur, sanity check
|
|
433
|
+
assertNotNull(lastRow, 'Selected ranges should not be empty');
|
|
434
|
+
var lastRowSize = GridRange.rowCount([lastRow]);
|
|
435
|
+
// should never occur, sanity check
|
|
436
|
+
assertNotNaN(lastRowSize, 'Selected ranges should not be unbounded');
|
|
437
|
+
|
|
438
|
+
// if removing the last rows makes it dip below the max, then need to
|
|
439
|
+
// bring it back but truncated
|
|
440
|
+
if (rowCount - lastRowSize < MAX_MULTISELECT_ROWS) {
|
|
441
|
+
var _lastRow$endRow;
|
|
442
|
+
// nullish operator to make TS happy, but the check above should prevent this
|
|
443
|
+
selectedRanges.push(new GridRange(lastRow.startColumn, lastRow.startRow, lastRow.endColumn, ((_lastRow$endRow = lastRow.endRow) !== null && _lastRow$endRow !== void 0 ? _lastRow$endRow : 0) - (rowCount - MAX_MULTISELECT_ROWS)));
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
rowCount -= lastRowSize;
|
|
447
|
+
}
|
|
448
|
+
} else {
|
|
449
|
+
// if the block is not in the selected ranges, meaning the user must've right-clicked
|
|
450
|
+
// outside the selected ranges`
|
|
451
|
+
selectedRanges = [new GridRange(sourceColumn, sourceRow, sourceColumn, sourceRow)];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// this should be non empty
|
|
455
|
+
// - valid selected ranges will always have a startRow and endRow
|
|
456
|
+
// - if there are no selected ranges, then one with sourceColumn/Row is added
|
|
457
|
+
assertNotEmpty(selectedRanges);
|
|
458
|
+
|
|
459
|
+
// get the snapshot values, but ignore all null/undefined values
|
|
460
|
+
var snapshot = yield model.snapshot(selectedRanges);
|
|
461
|
+
var snapshotValues = new Set();
|
|
462
|
+
for (var i = 0; i < snapshot.length; i += 1) {
|
|
463
|
+
if (snapshot[i].length === 1) {
|
|
464
|
+
// if the selected range has start/end columns defined, so the snapshot is a 1D array of the row
|
|
465
|
+
if (snapshot[i][0] != null) {
|
|
466
|
+
snapshotValues.add(snapshot[i][0]);
|
|
467
|
+
}
|
|
468
|
+
} else if (snapshot[i][sourceColumn] != null) {
|
|
469
|
+
// if the selected range is an entire row
|
|
470
|
+
snapshotValues.add(snapshot[i][sourceColumn]);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// if snapshotValues is empty here, it means all of the snapshot's values were null/undefined
|
|
474
|
+
|
|
475
|
+
var filterMenu = {
|
|
476
|
+
title: "Filter by Value".concat(snapshotValues.size > 1 ? 's' : ''),
|
|
477
|
+
icon: vsRemove,
|
|
478
|
+
iconColor: filterIconColor,
|
|
479
|
+
group: IrisGridContextMenuHandler.GROUP_FILTER,
|
|
480
|
+
order: 10,
|
|
481
|
+
actions: []
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// only made of null/undefineds
|
|
485
|
+
if (snapshotValues.size === 0) {
|
|
486
|
+
// null gets a special menu
|
|
487
|
+
if (quickFilters.get(sourceColumn)) {
|
|
488
|
+
filterMenu.actions.push({
|
|
489
|
+
title: 'And',
|
|
490
|
+
actions: _this.nullFilterActions(column, quickFilters.get(sourceColumn), '&&'),
|
|
491
|
+
order: 2,
|
|
492
|
+
group: ContextActions.groups.high
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
filterMenu.actions.push(..._this.nullFilterActions(column));
|
|
496
|
+
} else if (snapshotValues.size === 1 && snapshotValues.has('')) {
|
|
497
|
+
// empty string gets a special menu
|
|
498
|
+
if (quickFilters.get(sourceColumn)) {
|
|
499
|
+
filterMenu.actions.push({
|
|
500
|
+
title: 'And',
|
|
501
|
+
actions: _this.emptyStringFilterActions(column, quickFilters.get(sourceColumn), '&&'),
|
|
502
|
+
order: 2,
|
|
503
|
+
group: ContextActions.groups.high
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
filterMenu.actions.push(..._this.emptyStringFilterActions(column));
|
|
507
|
+
} else if (TableUtils.isBooleanType(column.type)) {
|
|
508
|
+
// boolean should have OR condition, and handles it's own null menu options
|
|
509
|
+
if (quickFilters.get(sourceColumn)) {
|
|
510
|
+
filterMenu.actions.push({
|
|
511
|
+
title: 'Or',
|
|
512
|
+
actions: _this.booleanFilterActions(column, model.textForCell(sourceColumn, sourceRow), quickFilters.get(sourceColumn), '||'),
|
|
513
|
+
order: 2,
|
|
514
|
+
group: ContextActions.groups.high
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
filterMenu.actions.push(..._this.booleanFilterActions(column, model.textForCell(sourceColumn, sourceRow)));
|
|
518
|
+
} else if (TableUtils.isNumberType(column.type) || TableUtils.isCharType(column.type)) {
|
|
519
|
+
// Chars get treated like numbers in terms of which filters are available
|
|
520
|
+
assertNotNull(sourceColumn);
|
|
521
|
+
if (quickFilters.get(sourceColumn)) {
|
|
522
|
+
filterMenu.actions.push({
|
|
523
|
+
title: 'And',
|
|
524
|
+
actions: _this.numberFilterActions(column, snapshotValues, quickFilters.get(sourceColumn), '&&'),
|
|
525
|
+
order: 2,
|
|
526
|
+
group: ContextActions.groups.high
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
filterMenu.actions.push(..._this.numberFilterActions(column, snapshotValues, quickFilters.get(sourceColumn)));
|
|
530
|
+
} else if (TableUtils.isDateType(column.type)) {
|
|
531
|
+
var dateFilterFormatter = new DateTimeColumnFormatter(dh, {
|
|
532
|
+
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone,
|
|
533
|
+
showTimeZone: false,
|
|
534
|
+
showTSeparator: true,
|
|
535
|
+
defaultDateTimeFormatString: CONTEXT_MENU_DATE_FORMAT
|
|
536
|
+
});
|
|
537
|
+
var previewFilterFormatter = new DateTimeColumnFormatter(dh, {
|
|
538
|
+
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone,
|
|
539
|
+
showTimeZone: settings === null || settings === void 0 ? void 0 : settings.showTimeZone,
|
|
540
|
+
showTSeparator: settings === null || settings === void 0 ? void 0 : settings.showTSeparator,
|
|
541
|
+
defaultDateTimeFormatString: CONTEXT_MENU_DATE_FORMAT
|
|
542
|
+
});
|
|
543
|
+
if (quickFilters.get(sourceColumn)) {
|
|
544
|
+
filterMenu.actions.push({
|
|
545
|
+
title: 'And',
|
|
546
|
+
actions: _this.dateFilterActions(column, snapshotValues, dateFilterFormatter, previewFilterFormatter, quickFilters.get(sourceColumn), '&&'),
|
|
547
|
+
order: 2,
|
|
548
|
+
group: ContextActions.groups.high
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
filterMenu.actions.push(..._this.dateFilterActions(column, snapshotValues, dateFilterFormatter, previewFilterFormatter, quickFilters.get(sourceColumn)));
|
|
552
|
+
} else {
|
|
553
|
+
if (quickFilters.get(sourceColumn)) {
|
|
554
|
+
filterMenu.actions.push({
|
|
555
|
+
title: 'And',
|
|
556
|
+
actions: _this.stringFilterActions(column, snapshotValues, quickFilters.get(sourceColumn), '&&'),
|
|
557
|
+
order: 2,
|
|
558
|
+
group: ContextActions.groups.high
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
filterMenu.actions.push(..._this.stringFilterActions(column, snapshotValues));
|
|
562
|
+
}
|
|
563
|
+
return [filterMenu];
|
|
564
|
+
})();
|
|
565
|
+
}
|
|
566
|
+
|
|
480
567
|
/**
|
|
481
568
|
* Gets an equality filter for the provided numeric value
|
|
482
569
|
* @param column The column to make the filter for
|
|
@@ -588,6 +675,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
588
675
|
// grid body context menu options
|
|
589
676
|
if (modelColumn != null && modelRow != null) {
|
|
590
677
|
actions.push(...this.getCellActions(modelColumn, grid, gridPoint));
|
|
678
|
+
actions.push(this.getCellFilterActions(modelColumn, grid, gridPoint));
|
|
591
679
|
}
|
|
592
680
|
|
|
593
681
|
// blank space context menu options
|
|
@@ -629,7 +717,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
629
717
|
return true;
|
|
630
718
|
}
|
|
631
719
|
dateFormatActions(column) {
|
|
632
|
-
var
|
|
720
|
+
var _this2 = this;
|
|
633
721
|
var {
|
|
634
722
|
model
|
|
635
723
|
} = this.irisGrid.props;
|
|
@@ -656,7 +744,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
656
744
|
action: () => {
|
|
657
745
|
var modelIndex = model.getColumnIndexByName(column.name);
|
|
658
746
|
assertNotNull(modelIndex);
|
|
659
|
-
|
|
747
|
+
_this2.irisGrid.handleFormatSelection(modelIndex, format);
|
|
660
748
|
}
|
|
661
749
|
});
|
|
662
750
|
};
|
|
@@ -666,7 +754,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
666
754
|
return actions;
|
|
667
755
|
}
|
|
668
756
|
numberFormatActions(column) {
|
|
669
|
-
var
|
|
757
|
+
var _this3 = this;
|
|
670
758
|
var {
|
|
671
759
|
model
|
|
672
760
|
} = this.irisGrid.props;
|
|
@@ -707,7 +795,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
707
795
|
return;
|
|
708
796
|
}
|
|
709
797
|
assertNotNull(columnIndex);
|
|
710
|
-
|
|
798
|
+
_this3.irisGrid.handleFormatSelection(columnIndex, format);
|
|
711
799
|
}
|
|
712
800
|
}));
|
|
713
801
|
};
|
|
@@ -716,11 +804,13 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
716
804
|
}
|
|
717
805
|
return actions;
|
|
718
806
|
}
|
|
719
|
-
stringFilterActions(column,
|
|
807
|
+
stringFilterActions(column, snapshotValues, quickFilter, operator) {
|
|
720
808
|
var {
|
|
721
809
|
dh
|
|
722
810
|
} = this;
|
|
723
|
-
var
|
|
811
|
+
var values = Array.from(snapshotValues.keys());
|
|
812
|
+
var filterValues = values.map(value => dh.FilterValue.ofString(value));
|
|
813
|
+
var valueDescription = filterValues.length === 1 ? filterValues[0] : 'the selected values';
|
|
724
814
|
var newQuickFilter = quickFilter;
|
|
725
815
|
if (!newQuickFilter) {
|
|
726
816
|
newQuickFilter = {
|
|
@@ -737,74 +827,84 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
737
827
|
model
|
|
738
828
|
} = this.irisGrid.props;
|
|
739
829
|
var columnIndex = model.getColumnIndexByName(column.name);
|
|
740
|
-
var
|
|
830
|
+
var toFilterText = item => {
|
|
831
|
+
var _TableUtils$escapeQui;
|
|
832
|
+
return (_TableUtils$escapeQui = TableUtils.escapeQuickTextFilter(item)) !== null && _TableUtils$escapeQui !== void 0 ? _TableUtils$escapeQui : '';
|
|
833
|
+
};
|
|
741
834
|
assertNotNull(columnIndex);
|
|
742
835
|
actions.push({
|
|
743
836
|
menuElement: /*#__PURE__*/_jsxs("div", {
|
|
744
837
|
className: "iris-grid-filter-menu-item-value",
|
|
745
|
-
children: [operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', "\"",
|
|
838
|
+
children: [operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', TextUtils.join(values.slice(0, 20).map(value => "\"".concat(toFilterText(value), "\""))), values.length > 1 && /*#__PURE__*/_jsxs("div", {
|
|
839
|
+
className: "iris-grid-filter-menu-subtitle",
|
|
840
|
+
children: ["(", values.length, " values selected)"]
|
|
841
|
+
})]
|
|
746
842
|
}),
|
|
747
843
|
order: 1,
|
|
748
844
|
group: ContextActions.groups.high
|
|
749
845
|
});
|
|
750
846
|
actions.push({
|
|
751
847
|
title: 'text is exactly',
|
|
752
|
-
description: "Show only rows where ".concat(column.name, " is ").concat(
|
|
848
|
+
description: "Show only rows where ".concat(column.name, " is ").concat(valueDescription, " (case sensitive)"),
|
|
753
849
|
action: () => {
|
|
754
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().eq(filterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText,
|
|
850
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, filterValues.map(filterValue => column.filter().eq(filterValue)).reduce((prev, curr) => prev.or(curr)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(toFilterText).join(' || '), operator));
|
|
755
851
|
},
|
|
756
852
|
order: 10,
|
|
757
853
|
group: ContextActions.groups.low
|
|
758
854
|
});
|
|
759
855
|
actions.push({
|
|
760
856
|
title: 'text is not exactly',
|
|
761
|
-
description: "Show only rows where ".concat(column.name, " is not ").concat(
|
|
857
|
+
description: "Show only rows where ".concat(column.name, " is not ").concat(valueDescription, " (case sensitive)"),
|
|
762
858
|
action: () => {
|
|
763
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().notEq(filterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "!=".concat(
|
|
859
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, filterValues.map(filterValue => column.filter().notEq(filterValue)).reduce((prev, curr) => prev.and(curr)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "!=".concat(toFilterText(value))).join(' && '), operator));
|
|
764
860
|
},
|
|
765
861
|
order: 20,
|
|
766
862
|
group: ContextActions.groups.low
|
|
767
863
|
});
|
|
768
864
|
actions.push({
|
|
769
865
|
title: "text contains",
|
|
770
|
-
description: "Show only rows where ".concat(column.name, " contains ").concat(
|
|
866
|
+
description: "Show only rows where ".concat(column.name, " contains ").concat(valueDescription),
|
|
771
867
|
action: () => {
|
|
772
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().not().and(column.filter().contains(filterValue)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "~".concat(
|
|
868
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().not().and(filterValues.map(filterValue => column.filter().contains(filterValue)).reduce((prev, curr) => prev.or(curr))), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "~".concat(toFilterText(value))).join(' || '), operator));
|
|
773
869
|
},
|
|
774
870
|
order: 30,
|
|
775
871
|
group: ContextActions.groups.low
|
|
776
872
|
});
|
|
777
873
|
actions.push({
|
|
778
874
|
title: 'text does not contain',
|
|
779
|
-
description: "Show only rows where ".concat(column.name, " does not contain ").concat(
|
|
875
|
+
description: "Show only rows where ".concat(column.name, " does not contain ").concat(valueDescription),
|
|
780
876
|
action: () => {
|
|
781
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().or(column.filter().contains(filterValue).not()), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "!~".concat(
|
|
877
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().or(filterValues.map(filterValue => column.filter().contains(filterValue).not()).reduce((prev, curr) => prev.and(curr))), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "!~".concat(toFilterText(value))).join(' && '), operator));
|
|
782
878
|
},
|
|
783
879
|
order: 40,
|
|
784
880
|
group: ContextActions.groups.low
|
|
785
881
|
});
|
|
786
882
|
actions.push({
|
|
787
883
|
title: 'text starts with',
|
|
788
|
-
description: "Show only rows where ".concat(column.name, " starts with ").concat(
|
|
884
|
+
description: "Show only rows where ".concat(column.name, " starts with ").concat(valueDescription),
|
|
789
885
|
action: () => {
|
|
790
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().not().and(column.filter().invoke('startsWith', filterValue)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "".concat(
|
|
886
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().not().and(filterValues.map(filterValue => column.filter().invoke('startsWith', filterValue)).reduce((prev, curr) => prev.or(curr))), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "".concat(toFilterText(value), "*")).join(' || '), operator));
|
|
791
887
|
},
|
|
792
888
|
order: 50,
|
|
793
889
|
group: ContextActions.groups.low
|
|
794
890
|
});
|
|
795
891
|
actions.push({
|
|
796
892
|
title: 'text ends with',
|
|
797
|
-
description: "Show only rows where ".concat(column.name, " ends with ").concat(
|
|
893
|
+
description: "Show only rows where ".concat(column.name, " ends with ").concat(valueDescription),
|
|
798
894
|
action: () => {
|
|
799
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().not().and(column.filter().invoke('endsWith', filterValue)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "*".concat(
|
|
895
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().isNull().not().and(filterValues.map(filterValue => column.filter().invoke('endsWith', filterValue)).reduce((prev, curr) => prev.or(curr))), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "*".concat(toFilterText(value))).join(' || '), operator));
|
|
800
896
|
},
|
|
801
897
|
order: 60,
|
|
802
898
|
group: ContextActions.groups.low
|
|
803
899
|
});
|
|
804
900
|
return actions;
|
|
805
901
|
}
|
|
806
|
-
numberFilterActions(column,
|
|
807
|
-
var
|
|
902
|
+
numberFilterActions(column, snapshotValues, quickFilter, operator) {
|
|
903
|
+
var values = Array.from(snapshotValues.keys());
|
|
904
|
+
var valueDesc = values.length === 1 ? "".concat(values) : 'the selected values';
|
|
905
|
+
// We want to show the full unformatted value if it's a number, so user knows which value they are matching
|
|
906
|
+
// If it's a Char we just show the char
|
|
907
|
+
var toFilterText = item => TableUtils.isCharType(column.type) ? String.fromCharCode(item) : "".concat(item);
|
|
808
908
|
var filter = null;
|
|
809
909
|
var filterText = null;
|
|
810
910
|
if (quickFilter) {
|
|
@@ -812,7 +912,6 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
812
912
|
filterText = quickFilter.text;
|
|
813
913
|
}
|
|
814
914
|
var actions = [];
|
|
815
|
-
var isFinite = value !== Number.POSITIVE_INFINITY && value !== Number.NEGATIVE_INFINITY && !Number.isNaN(value);
|
|
816
915
|
var {
|
|
817
916
|
model
|
|
818
917
|
} = this.irisGrid.props;
|
|
@@ -821,27 +920,28 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
821
920
|
actions.push({
|
|
822
921
|
menuElement: /*#__PURE__*/_jsxs("div", {
|
|
823
922
|
className: "iris-grid-filter-menu-item-value",
|
|
824
|
-
children: [operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', "\"",
|
|
923
|
+
children: [operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', TextUtils.join(values.slice(0, 20).map(value => "\"".concat(toFilterText(value), "\""))), values.length > 1 && /*#__PURE__*/_jsxs("div", {
|
|
924
|
+
className: "iris-grid-filter-menu-subtitle",
|
|
925
|
+
children: ["(", values.length, " values selected)"]
|
|
926
|
+
})]
|
|
825
927
|
}),
|
|
826
928
|
order: 1,
|
|
827
929
|
group: ContextActions.groups.high
|
|
828
930
|
});
|
|
829
931
|
actions.push({
|
|
830
932
|
title: 'is equal to',
|
|
831
|
-
description: "Show only rows where ".concat(column.name, " is ").concat(
|
|
933
|
+
description: "Show only rows where ".concat(column.name, " is ").concat(valueDesc),
|
|
832
934
|
action: () => {
|
|
833
|
-
|
|
834
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, valueFilter, operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "=".concat(valueText), operator));
|
|
935
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, values.map(value => this.getNumberValueEqualsFilter(column, value)).reduce((acc, curr) => acc.or(curr)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "=".concat(toFilterText(value))).join(' || '), operator));
|
|
835
936
|
},
|
|
836
937
|
order: 10,
|
|
837
938
|
group: ContextActions.groups.low
|
|
838
939
|
});
|
|
839
940
|
actions.push({
|
|
840
941
|
title: 'is not equal to',
|
|
841
|
-
description: "Show only rows where ".concat(column.name, " is not ").concat(
|
|
942
|
+
description: "Show only rows where ".concat(column.name, " is not ").concat(valueDesc),
|
|
842
943
|
action: () => {
|
|
843
|
-
|
|
844
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, valueFilter, operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "!=".concat(valueText), operator));
|
|
944
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, values.map(value => this.getNumberValueEqualsFilter(column, value).not()).reduce((acc, curr) => acc.and(curr)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "!=".concat(toFilterText(value))).join(' && '), operator));
|
|
845
945
|
},
|
|
846
946
|
order: 20,
|
|
847
947
|
group: ContextActions.groups.low
|
|
@@ -850,39 +950,46 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
850
950
|
// IDS-6092 Less/greater than filters don't make sense for Infinite/NaN
|
|
851
951
|
// TODO (DH-11799): These char filters should work in Bard, with the merge for DH-11040: https://gitlab.eng.illumon.com/illumon/iris/merge_requests/5801
|
|
852
952
|
// They do not work in Powell though, so disable them.
|
|
853
|
-
if (
|
|
953
|
+
if (!snapshotValues.has(Number.NaN) && !snapshotValues.has(Number.POSITIVE_INFINITY) && !snapshotValues.has(Number.NEGATIVE_INFINITY) && !TableUtils.isCharType(column.type)) {
|
|
954
|
+
// get the min/max because these are all ge/ne filters
|
|
955
|
+
var maxValue = values.reduce((a, b) => a > b ? a : b);
|
|
956
|
+
var minValue = values.reduce((a, b) => a < b ? a : b);
|
|
957
|
+
var maxFilterValue = this.getFilterValueForNumberOrChar(column.type, maxValue);
|
|
958
|
+
var minFilterValue = this.getFilterValueForNumberOrChar(column.type, minValue);
|
|
959
|
+
var maxValueText = "".concat(maxFilterValue);
|
|
960
|
+
var minValueText = "".concat(minFilterValue);
|
|
854
961
|
actions.push({
|
|
855
962
|
title: 'greater than',
|
|
856
|
-
description: "Show only rows where ".concat(column.name, " is greater than ").concat(
|
|
963
|
+
description: "Show only rows where ".concat(column.name, " is greater than ").concat(maxValueText),
|
|
857
964
|
action: () => {
|
|
858
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThan(
|
|
965
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThan(maxFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, ">".concat(toFilterText(maxValue)), operator));
|
|
859
966
|
},
|
|
860
967
|
order: 30,
|
|
861
968
|
group: ContextActions.groups.low
|
|
862
969
|
});
|
|
863
970
|
actions.push({
|
|
864
971
|
title: 'greater than or equal to',
|
|
865
|
-
description: "Show only rows where ".concat(column.name, " is greater than or equal to ").concat(
|
|
972
|
+
description: "Show only rows where ".concat(column.name, " is greater than or equal to ").concat(maxValueText),
|
|
866
973
|
action: () => {
|
|
867
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThanOrEqualTo(
|
|
974
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThanOrEqualTo(maxFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, ">=".concat(toFilterText(maxValue)), operator));
|
|
868
975
|
},
|
|
869
976
|
order: 40,
|
|
870
977
|
group: ContextActions.groups.low
|
|
871
978
|
});
|
|
872
979
|
actions.push({
|
|
873
980
|
title: 'less than',
|
|
874
|
-
description: "Show only rows where ".concat(column.name, " is less than ").concat(
|
|
981
|
+
description: "Show only rows where ".concat(column.name, " is less than ").concat(minValueText),
|
|
875
982
|
action: () => {
|
|
876
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThan(
|
|
983
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThan(minFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "<".concat(toFilterText(minValue)), operator));
|
|
877
984
|
},
|
|
878
985
|
order: 50,
|
|
879
986
|
group: ContextActions.groups.low
|
|
880
987
|
});
|
|
881
988
|
actions.push({
|
|
882
989
|
title: 'less than or equal to',
|
|
883
|
-
description: "Show only rows where ".concat(column.name, " is less than or equal to ").concat(
|
|
990
|
+
description: "Show only rows where ".concat(column.name, " is less than or equal to ").concat(minValueText),
|
|
884
991
|
action: () => {
|
|
885
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThanOrEqualTo(
|
|
992
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThanOrEqualTo(minFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "<=".concat(toFilterText(minValue)), operator));
|
|
886
993
|
},
|
|
887
994
|
order: 60,
|
|
888
995
|
group: ContextActions.groups.low
|
|
@@ -947,11 +1054,21 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
947
1054
|
});
|
|
948
1055
|
return actions;
|
|
949
1056
|
}
|
|
950
|
-
dateFilterActions(column,
|
|
1057
|
+
dateFilterActions(column, snapshotValues, dateFilterFormatter, previewFilterFormatter, quickFilter, operator) {
|
|
951
1058
|
var {
|
|
952
1059
|
dh
|
|
953
1060
|
} = this;
|
|
954
|
-
var
|
|
1061
|
+
var values = Array.from(snapshotValues.keys());
|
|
1062
|
+
var filterValues = values.map(value => dh.FilterValue.ofNumber(value));
|
|
1063
|
+
var valueDesc = filterValues.length === 1 ? previewFilterFormatter.format(values[0]) : 'the selected values';
|
|
1064
|
+
var maxValue = values.reduce((a, b) => a > b ? a : b);
|
|
1065
|
+
var minValue = values.reduce((a, b) => a < b ? a : b);
|
|
1066
|
+
var maxFilterValue = dh.FilterValue.ofNumber(maxValue);
|
|
1067
|
+
var minFilterValue = dh.FilterValue.ofNumber(minValue);
|
|
1068
|
+
var maxDateText = dateFilterFormatter.format(maxValue);
|
|
1069
|
+
var minDateText = dateFilterFormatter.format(minValue);
|
|
1070
|
+
var maxPreviewText = previewFilterFormatter.format(maxValue);
|
|
1071
|
+
var minPreviewText = previewFilterFormatter.format(minValue);
|
|
955
1072
|
var filter = null;
|
|
956
1073
|
var filterText = null;
|
|
957
1074
|
if (quickFilter) {
|
|
@@ -967,61 +1084,64 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
967
1084
|
actions.push({
|
|
968
1085
|
menuElement: /*#__PURE__*/_jsxs("div", {
|
|
969
1086
|
className: "iris-grid-filter-menu-item-value",
|
|
970
|
-
children: [operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', "\"",
|
|
1087
|
+
children: [operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', TextUtils.join(values.slice(0, 20).map(value => "\"".concat(previewFilterFormatter.format(value), "\""))), values.length > 1 && /*#__PURE__*/_jsxs("div", {
|
|
1088
|
+
className: "iris-grid-filter-menu-subtitle",
|
|
1089
|
+
children: ["(", values.length, " values selected)"]
|
|
1090
|
+
})]
|
|
971
1091
|
}),
|
|
972
1092
|
order: 1,
|
|
973
1093
|
group: ContextActions.groups.high
|
|
974
1094
|
});
|
|
975
1095
|
actions.push({
|
|
976
1096
|
title: 'date is',
|
|
977
|
-
description: "Show only rows where ".concat(column.name, " is ").concat(
|
|
1097
|
+
description: "Show only rows where ".concat(column.name, " is ").concat(valueDesc),
|
|
978
1098
|
action: () => {
|
|
979
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().eq(
|
|
1099
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, filterValues.map(valueFilter => column.filter().eq(valueFilter)).reduce((acc, curr) => acc.or(curr)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "=".concat(dateFilterFormatter.format(value))).join(' || '), operator));
|
|
980
1100
|
},
|
|
981
1101
|
order: 10,
|
|
982
1102
|
group: ContextActions.groups.low
|
|
983
1103
|
});
|
|
984
1104
|
actions.push({
|
|
985
1105
|
title: 'date is not',
|
|
986
|
-
description: "Show only rows where ".concat(column.name, " is not ").concat(
|
|
1106
|
+
description: "Show only rows where ".concat(column.name, " is not ").concat(valueDesc),
|
|
987
1107
|
action: () => {
|
|
988
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().notEq(
|
|
1108
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, filterValues.map(valueFilter => column.filter().notEq(valueFilter)).reduce((acc, curr) => acc.and(curr)), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, values.map(value => "!=".concat(dateFilterFormatter.format(value))).join(' && '), operator));
|
|
989
1109
|
},
|
|
990
1110
|
order: 20,
|
|
991
1111
|
group: ContextActions.groups.low
|
|
992
1112
|
});
|
|
993
1113
|
actions.push({
|
|
994
1114
|
title: 'date is before',
|
|
995
|
-
description: "Show only rows where ".concat(column.name, " is before ").concat(
|
|
1115
|
+
description: "Show only rows where ".concat(column.name, " is before ").concat(minPreviewText),
|
|
996
1116
|
action: () => {
|
|
997
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThan(
|
|
1117
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThan(minFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "<".concat(minDateText), operator));
|
|
998
1118
|
},
|
|
999
1119
|
order: 30,
|
|
1000
1120
|
group: ContextActions.groups.low
|
|
1001
1121
|
});
|
|
1002
1122
|
actions.push({
|
|
1003
1123
|
title: 'date is before or equal',
|
|
1004
|
-
description: "Show only rows where ".concat(column.name, " is before or equal to ").concat(
|
|
1124
|
+
description: "Show only rows where ".concat(column.name, " is before or equal to ").concat(minPreviewText),
|
|
1005
1125
|
action: () => {
|
|
1006
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThanOrEqualTo(
|
|
1126
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().lessThanOrEqualTo(minFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, "<=".concat(minDateText), operator));
|
|
1007
1127
|
},
|
|
1008
1128
|
order: 40,
|
|
1009
1129
|
group: ContextActions.groups.low
|
|
1010
1130
|
});
|
|
1011
1131
|
actions.push({
|
|
1012
1132
|
title: 'date is after',
|
|
1013
|
-
description: "Show only rows where ".concat(column.name, " is greater than ").concat(
|
|
1133
|
+
description: "Show only rows where ".concat(column.name, " is greater than ").concat(maxPreviewText),
|
|
1014
1134
|
action: () => {
|
|
1015
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThan(
|
|
1135
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThan(maxFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, ">".concat(maxDateText), operator));
|
|
1016
1136
|
},
|
|
1017
1137
|
order: 50,
|
|
1018
1138
|
group: ContextActions.groups.low
|
|
1019
1139
|
});
|
|
1020
1140
|
actions.push({
|
|
1021
1141
|
title: 'date is after or equal',
|
|
1022
|
-
description: "Show only rows where ".concat(column.name, " is after or equal to ").concat(
|
|
1142
|
+
description: "Show only rows where ".concat(column.name, " is after or equal to ").concat(maxPreviewText),
|
|
1023
1143
|
action: () => {
|
|
1024
|
-
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThanOrEqualTo(
|
|
1144
|
+
this.irisGrid.setQuickFilter(columnIndex, IrisGridContextMenuHandler.getQuickFilterCondition(filter, column.filter().greaterThanOrEqualTo(maxFilterValue), operator), IrisGridContextMenuHandler.getQuickFilterText(filterText, ">=".concat(maxDateText), operator));
|
|
1025
1145
|
},
|
|
1026
1146
|
order: 60,
|
|
1027
1147
|
group: ContextActions.groups.low
|