@deephaven/js-plugin-pivot 0.2.1-dev.1002 → 0.3.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/index.js +886 -394
- package/package.json +8 -9
package/dist/index.js
CHANGED
|
@@ -274,6 +274,9 @@ class EventShimCustomEvent extends CustomEvent {
|
|
|
274
274
|
super(typeArg, eventInitDict);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
+
function isNotNullOrUndefined(value2) {
|
|
278
|
+
return value2 != null;
|
|
279
|
+
}
|
|
277
280
|
function assertNotNull(value2) {
|
|
278
281
|
var message = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "Value is null or undefined";
|
|
279
282
|
if (value2 == null)
|
|
@@ -1690,30 +1693,24 @@ function find(str2, type = null, opts = null) {
|
|
|
1690
1693
|
}
|
|
1691
1694
|
return filtered;
|
|
1692
1695
|
}
|
|
1693
|
-
function _defineProperty$9(
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
var
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
return input;
|
|
1709
|
-
var prim = input[Symbol.toPrimitive];
|
|
1710
|
-
if (prim !== void 0) {
|
|
1711
|
-
var res = prim.call(input, hint || "default");
|
|
1712
|
-
if (typeof res !== "object")
|
|
1713
|
-
return res;
|
|
1696
|
+
function _defineProperty$9(e, r, t) {
|
|
1697
|
+
return (r = _toPropertyKey$9(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
1698
|
+
}
|
|
1699
|
+
function _toPropertyKey$9(t) {
|
|
1700
|
+
var i = _toPrimitive$9(t, "string");
|
|
1701
|
+
return "symbol" == typeof i ? i : i + "";
|
|
1702
|
+
}
|
|
1703
|
+
function _toPrimitive$9(t, r) {
|
|
1704
|
+
if ("object" != typeof t || !t)
|
|
1705
|
+
return t;
|
|
1706
|
+
var e = t[Symbol.toPrimitive];
|
|
1707
|
+
if (void 0 !== e) {
|
|
1708
|
+
var i = e.call(t, r || "default");
|
|
1709
|
+
if ("object" != typeof i)
|
|
1710
|
+
return i;
|
|
1714
1711
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1715
1712
|
}
|
|
1716
|
-
return (
|
|
1713
|
+
return ("string" === r ? String : Number)(t);
|
|
1717
1714
|
}
|
|
1718
1715
|
var SELECTION_DIRECTION;
|
|
1719
1716
|
(function(SELECTION_DIRECTION2) {
|
|
@@ -2349,51 +2346,45 @@ function isAxisRange(range) {
|
|
|
2349
2346
|
function isBoundedAxisRange(range) {
|
|
2350
2347
|
return isAxisRange(range) && range[0] != null && range[1] != null;
|
|
2351
2348
|
}
|
|
2352
|
-
function ownKeys$1(
|
|
2353
|
-
var
|
|
2349
|
+
function ownKeys$1(e, r) {
|
|
2350
|
+
var t = Object.keys(e);
|
|
2354
2351
|
if (Object.getOwnPropertySymbols) {
|
|
2355
|
-
var
|
|
2356
|
-
|
|
2357
|
-
return Object.getOwnPropertyDescriptor(
|
|
2358
|
-
})),
|
|
2359
|
-
}
|
|
2360
|
-
return
|
|
2361
|
-
}
|
|
2362
|
-
function _objectSpread$1(
|
|
2363
|
-
for (var
|
|
2364
|
-
var
|
|
2365
|
-
|
|
2366
|
-
_defineProperty$8(
|
|
2367
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
2368
|
-
Object.defineProperty(
|
|
2352
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
2353
|
+
r && (o = o.filter(function(r2) {
|
|
2354
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
2355
|
+
})), t.push.apply(t, o);
|
|
2356
|
+
}
|
|
2357
|
+
return t;
|
|
2358
|
+
}
|
|
2359
|
+
function _objectSpread$1(e) {
|
|
2360
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
2361
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
2362
|
+
r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) {
|
|
2363
|
+
_defineProperty$8(e, r2, t[r2]);
|
|
2364
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) {
|
|
2365
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
2369
2366
|
});
|
|
2370
2367
|
}
|
|
2371
|
-
return
|
|
2368
|
+
return e;
|
|
2372
2369
|
}
|
|
2373
|
-
function _defineProperty$8(
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
var
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
return input;
|
|
2389
|
-
var prim = input[Symbol.toPrimitive];
|
|
2390
|
-
if (prim !== void 0) {
|
|
2391
|
-
var res = prim.call(input, hint || "default");
|
|
2392
|
-
if (typeof res !== "object")
|
|
2393
|
-
return res;
|
|
2370
|
+
function _defineProperty$8(e, r, t) {
|
|
2371
|
+
return (r = _toPropertyKey$8(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
2372
|
+
}
|
|
2373
|
+
function _toPropertyKey$8(t) {
|
|
2374
|
+
var i = _toPrimitive$8(t, "string");
|
|
2375
|
+
return "symbol" == typeof i ? i : i + "";
|
|
2376
|
+
}
|
|
2377
|
+
function _toPrimitive$8(t, r) {
|
|
2378
|
+
if ("object" != typeof t || !t)
|
|
2379
|
+
return t;
|
|
2380
|
+
var e = t[Symbol.toPrimitive];
|
|
2381
|
+
if (void 0 !== e) {
|
|
2382
|
+
var i = e.call(t, r || "default");
|
|
2383
|
+
if ("object" != typeof i)
|
|
2384
|
+
return i;
|
|
2394
2385
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2395
2386
|
}
|
|
2396
|
-
return (
|
|
2387
|
+
return ("string" === r ? String : Number)(t);
|
|
2397
2388
|
}
|
|
2398
2389
|
class GridUtils {
|
|
2399
2390
|
// use same constant as chrome source for windows
|
|
@@ -2666,15 +2657,35 @@ class GridUtils {
|
|
|
2666
2657
|
} = metrics;
|
|
2667
2658
|
return GridUtils.getNextShownItem(startIndex, modelRows, visibleRows, userRowHeights);
|
|
2668
2659
|
}
|
|
2660
|
+
/**
|
|
2661
|
+
* Check if a separator exists between a column and the next column at a given depth.
|
|
2662
|
+
* A separator exists if adjacent columns have different header text at the specified depth.
|
|
2663
|
+
*
|
|
2664
|
+
* @param model The grid model
|
|
2665
|
+
* @param depth The header depth to check at
|
|
2666
|
+
* @param columnIndex The current model column index
|
|
2667
|
+
* @param nextColumnIndex The next model column index (undefined for last column)
|
|
2668
|
+
* @returns true if a separator should be shown, false otherwise
|
|
2669
|
+
*/
|
|
2670
|
+
static hasColumnSeparatorAtDepth(model, depth, columnIndex, nextColumnIndex) {
|
|
2671
|
+
if (depth == null || columnIndex == null) {
|
|
2672
|
+
return false;
|
|
2673
|
+
}
|
|
2674
|
+
if (nextColumnIndex == null) {
|
|
2675
|
+
return true;
|
|
2676
|
+
}
|
|
2677
|
+
return model.textForColumnHeader(columnIndex, depth) !== model.textForColumnHeader(nextColumnIndex, depth);
|
|
2678
|
+
}
|
|
2669
2679
|
/**
|
|
2670
2680
|
* Gets the column index if the x/y coordinates provided are close enough to the separator, otherwise null
|
|
2671
2681
|
* @param x Mouse x coordinate
|
|
2672
2682
|
* @param y Mouse y coordinate
|
|
2673
2683
|
* @param metrics The grid metrics
|
|
2674
2684
|
* @param theme The grid theme with potential user overrides
|
|
2685
|
+
* @param model The grid model
|
|
2675
2686
|
* @returns Index of the column separator at the coordinates provided, or null if none match
|
|
2676
2687
|
*/
|
|
2677
|
-
static getColumnSeparatorIndex(x, y, metrics, theme) {
|
|
2688
|
+
static getColumnSeparatorIndex(x, y, metrics, theme, model) {
|
|
2678
2689
|
var {
|
|
2679
2690
|
rowHeaderWidth,
|
|
2680
2691
|
columnHeaderHeight,
|
|
@@ -2683,7 +2694,8 @@ class GridUtils {
|
|
|
2683
2694
|
visibleColumns,
|
|
2684
2695
|
allColumnXs,
|
|
2685
2696
|
allColumnWidths,
|
|
2686
|
-
columnHeaderMaxDepth
|
|
2697
|
+
columnHeaderMaxDepth,
|
|
2698
|
+
modelColumns
|
|
2687
2699
|
} = metrics;
|
|
2688
2700
|
var {
|
|
2689
2701
|
allowColumnResize,
|
|
@@ -2694,6 +2706,7 @@ class GridUtils {
|
|
|
2694
2706
|
}
|
|
2695
2707
|
var gridX = x - rowHeaderWidth;
|
|
2696
2708
|
var halfSeparatorSize = headerSeparatorHandleSize * 0.5;
|
|
2709
|
+
var depth = GridUtils.getColumnHeaderDepthAtY(y, metrics);
|
|
2697
2710
|
var isPreviousColumnHidden = false;
|
|
2698
2711
|
for (var i = floatingColumns.length - 1; i >= 0; i -= 1) {
|
|
2699
2712
|
var _allColumnXs$get, _allColumnWidths$get;
|
|
@@ -2710,7 +2723,7 @@ class GridUtils {
|
|
|
2710
2723
|
}
|
|
2711
2724
|
var minX = midX - halfSeparatorSize;
|
|
2712
2725
|
var maxX = midX + halfSeparatorSize;
|
|
2713
|
-
if (minX <= gridX && gridX <= maxX) {
|
|
2726
|
+
if (minX <= gridX && gridX <= maxX && GridUtils.hasColumnSeparatorAtDepth(model, depth, modelColumns.get(column), modelColumns.get(column + 1))) {
|
|
2714
2727
|
return column;
|
|
2715
2728
|
}
|
|
2716
2729
|
isPreviousColumnHidden = isColumnHidden;
|
|
@@ -2735,7 +2748,7 @@ class GridUtils {
|
|
|
2735
2748
|
}
|
|
2736
2749
|
var _minX = _midX - halfSeparatorSize;
|
|
2737
2750
|
var _maxX = _midX + halfSeparatorSize;
|
|
2738
|
-
if (_minX <= gridX && gridX <= _maxX) {
|
|
2751
|
+
if (_minX <= gridX && gridX <= _maxX && GridUtils.hasColumnSeparatorAtDepth(model, depth, modelColumns.get(_column), modelColumns.get(_column + 1))) {
|
|
2739
2752
|
return _column;
|
|
2740
2753
|
}
|
|
2741
2754
|
isPreviousColumnHidden = _isColumnHidden;
|
|
@@ -5874,51 +5887,45 @@ var memoizee = function(fn) {
|
|
|
5874
5887
|
requireRefCounter();
|
|
5875
5888
|
return plain(fn, options);
|
|
5876
5889
|
};
|
|
5877
|
-
function ownKeys(
|
|
5878
|
-
var
|
|
5890
|
+
function ownKeys(e, r) {
|
|
5891
|
+
var t = Object.keys(e);
|
|
5879
5892
|
if (Object.getOwnPropertySymbols) {
|
|
5880
|
-
var
|
|
5881
|
-
|
|
5882
|
-
return Object.getOwnPropertyDescriptor(
|
|
5883
|
-
})),
|
|
5884
|
-
}
|
|
5885
|
-
return
|
|
5886
|
-
}
|
|
5887
|
-
function _objectSpread(
|
|
5888
|
-
for (var
|
|
5889
|
-
var
|
|
5890
|
-
|
|
5891
|
-
_defineProperty$7(
|
|
5892
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
5893
|
-
Object.defineProperty(
|
|
5893
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
5894
|
+
r && (o = o.filter(function(r2) {
|
|
5895
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
5896
|
+
})), t.push.apply(t, o);
|
|
5897
|
+
}
|
|
5898
|
+
return t;
|
|
5899
|
+
}
|
|
5900
|
+
function _objectSpread(e) {
|
|
5901
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
5902
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
5903
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
5904
|
+
_defineProperty$7(e, r2, t[r2]);
|
|
5905
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
5906
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
5894
5907
|
});
|
|
5895
5908
|
}
|
|
5896
|
-
return
|
|
5909
|
+
return e;
|
|
5897
5910
|
}
|
|
5898
|
-
function _defineProperty$7(
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
var
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
return input;
|
|
5914
|
-
var prim = input[Symbol.toPrimitive];
|
|
5915
|
-
if (prim !== void 0) {
|
|
5916
|
-
var res = prim.call(input, hint || "default");
|
|
5917
|
-
if (typeof res !== "object")
|
|
5918
|
-
return res;
|
|
5911
|
+
function _defineProperty$7(e, r, t) {
|
|
5912
|
+
return (r = _toPropertyKey$7(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
5913
|
+
}
|
|
5914
|
+
function _toPropertyKey$7(t) {
|
|
5915
|
+
var i = _toPrimitive$7(t, "string");
|
|
5916
|
+
return "symbol" == typeof i ? i : i + "";
|
|
5917
|
+
}
|
|
5918
|
+
function _toPrimitive$7(t, r) {
|
|
5919
|
+
if ("object" != typeof t || !t)
|
|
5920
|
+
return t;
|
|
5921
|
+
var e = t[Symbol.toPrimitive];
|
|
5922
|
+
if (void 0 !== e) {
|
|
5923
|
+
var i = e.call(t, r || "default");
|
|
5924
|
+
if ("object" != typeof i)
|
|
5925
|
+
return i;
|
|
5919
5926
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5920
5927
|
}
|
|
5921
|
-
return (
|
|
5928
|
+
return ("string" === r ? String : Number)(t);
|
|
5922
5929
|
}
|
|
5923
5930
|
var memoizeClear = (fn, options) => {
|
|
5924
5931
|
var isClearingCache = false;
|
|
@@ -6963,30 +6970,24 @@ const GridColorUtils = {
|
|
|
6963
6970
|
rgbToHex,
|
|
6964
6971
|
lerpColor
|
|
6965
6972
|
};
|
|
6966
|
-
function _defineProperty$6(
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
var
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
return input;
|
|
6982
|
-
var prim = input[Symbol.toPrimitive];
|
|
6983
|
-
if (prim !== void 0) {
|
|
6984
|
-
var res = prim.call(input, hint || "default");
|
|
6985
|
-
if (typeof res !== "object")
|
|
6986
|
-
return res;
|
|
6973
|
+
function _defineProperty$6(e, r, t) {
|
|
6974
|
+
return (r = _toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
6975
|
+
}
|
|
6976
|
+
function _toPropertyKey$6(t) {
|
|
6977
|
+
var i = _toPrimitive$6(t, "string");
|
|
6978
|
+
return "symbol" == typeof i ? i : i + "";
|
|
6979
|
+
}
|
|
6980
|
+
function _toPrimitive$6(t, r) {
|
|
6981
|
+
if ("object" != typeof t || !t)
|
|
6982
|
+
return t;
|
|
6983
|
+
var e = t[Symbol.toPrimitive];
|
|
6984
|
+
if (void 0 !== e) {
|
|
6985
|
+
var i = e.call(t, r || "default");
|
|
6986
|
+
if ("object" != typeof i)
|
|
6987
|
+
return i;
|
|
6987
6988
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
6988
6989
|
}
|
|
6989
|
-
return (
|
|
6990
|
+
return ("string" === r ? String : Number)(t);
|
|
6990
6991
|
}
|
|
6991
6992
|
class GridMouseHandler {
|
|
6992
6993
|
// What order this mouse handler should trigger in. Smaller numbers trigger first
|
|
@@ -7026,30 +7027,24 @@ class GridMouseHandler {
|
|
|
7026
7027
|
return false;
|
|
7027
7028
|
}
|
|
7028
7029
|
}
|
|
7029
|
-
function _defineProperty$5(
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
var
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
return input;
|
|
7045
|
-
var prim = input[Symbol.toPrimitive];
|
|
7046
|
-
if (prim !== void 0) {
|
|
7047
|
-
var res = prim.call(input, hint || "default");
|
|
7048
|
-
if (typeof res !== "object")
|
|
7049
|
-
return res;
|
|
7030
|
+
function _defineProperty$5(e, r, t) {
|
|
7031
|
+
return (r = _toPropertyKey$5(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
7032
|
+
}
|
|
7033
|
+
function _toPropertyKey$5(t) {
|
|
7034
|
+
var i = _toPrimitive$5(t, "string");
|
|
7035
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7036
|
+
}
|
|
7037
|
+
function _toPrimitive$5(t, r) {
|
|
7038
|
+
if ("object" != typeof t || !t)
|
|
7039
|
+
return t;
|
|
7040
|
+
var e = t[Symbol.toPrimitive];
|
|
7041
|
+
if (void 0 !== e) {
|
|
7042
|
+
var i = e.call(t, r || "default");
|
|
7043
|
+
if ("object" != typeof i)
|
|
7044
|
+
return i;
|
|
7050
7045
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7051
7046
|
}
|
|
7052
|
-
return (
|
|
7047
|
+
return ("string" === r ? String : Number)(t);
|
|
7053
7048
|
}
|
|
7054
7049
|
class GridSeparatorMouseHandler extends GridMouseHandler {
|
|
7055
7050
|
constructor() {
|
|
@@ -7257,30 +7252,24 @@ class GridSeparatorMouseHandler extends GridMouseHandler {
|
|
|
7257
7252
|
}
|
|
7258
7253
|
}
|
|
7259
7254
|
const GridSeparatorMouseHandler$1 = GridSeparatorMouseHandler;
|
|
7260
|
-
function _defineProperty$4(
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
var
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
return input;
|
|
7276
|
-
var prim = input[Symbol.toPrimitive];
|
|
7277
|
-
if (prim !== void 0) {
|
|
7278
|
-
var res = prim.call(input, hint || "default");
|
|
7279
|
-
if (typeof res !== "object")
|
|
7280
|
-
return res;
|
|
7255
|
+
function _defineProperty$4(e, r, t) {
|
|
7256
|
+
return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
7257
|
+
}
|
|
7258
|
+
function _toPropertyKey$4(t) {
|
|
7259
|
+
var i = _toPrimitive$4(t, "string");
|
|
7260
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7261
|
+
}
|
|
7262
|
+
function _toPrimitive$4(t, r) {
|
|
7263
|
+
if ("object" != typeof t || !t)
|
|
7264
|
+
return t;
|
|
7265
|
+
var e = t[Symbol.toPrimitive];
|
|
7266
|
+
if (void 0 !== e) {
|
|
7267
|
+
var i = e.call(t, r || "default");
|
|
7268
|
+
if ("object" != typeof i)
|
|
7269
|
+
return i;
|
|
7281
7270
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7282
7271
|
}
|
|
7283
|
-
return (
|
|
7272
|
+
return ("string" === r ? String : Number)(t);
|
|
7284
7273
|
}
|
|
7285
7274
|
class GridColumnSeparatorMouseHandler extends GridSeparatorMouseHandler$1 {
|
|
7286
7275
|
constructor() {
|
|
@@ -7313,7 +7302,7 @@ class GridColumnSeparatorMouseHandler extends GridSeparatorMouseHandler$1 {
|
|
|
7313
7302
|
var {
|
|
7314
7303
|
modelColumns
|
|
7315
7304
|
} = metrics;
|
|
7316
|
-
var separatorIndex = GridUtils.getColumnSeparatorIndex(x, y, metrics, theme);
|
|
7305
|
+
var separatorIndex = GridUtils.getColumnSeparatorIndex(x, y, metrics, theme, model);
|
|
7317
7306
|
if (separatorIndex == null || depth == null) {
|
|
7318
7307
|
return null;
|
|
7319
7308
|
}
|
|
@@ -7341,30 +7330,24 @@ class GridColumnSeparatorMouseHandler extends GridSeparatorMouseHandler$1 {
|
|
|
7341
7330
|
}
|
|
7342
7331
|
const GridColumnSeparatorMouseHandler$1 = GridColumnSeparatorMouseHandler;
|
|
7343
7332
|
var DEFAULT_FONT_WIDTH = 10;
|
|
7344
|
-
function _defineProperty$3(
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
var
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
return input;
|
|
7360
|
-
var prim = input[Symbol.toPrimitive];
|
|
7361
|
-
if (prim !== void 0) {
|
|
7362
|
-
var res = prim.call(input, hint || "default");
|
|
7363
|
-
if (typeof res !== "object")
|
|
7364
|
-
return res;
|
|
7333
|
+
function _defineProperty$3(e, r, t) {
|
|
7334
|
+
return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
7335
|
+
}
|
|
7336
|
+
function _toPropertyKey$3(t) {
|
|
7337
|
+
var i = _toPrimitive$3(t, "string");
|
|
7338
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7339
|
+
}
|
|
7340
|
+
function _toPrimitive$3(t, r) {
|
|
7341
|
+
if ("object" != typeof t || !t)
|
|
7342
|
+
return t;
|
|
7343
|
+
var e = t[Symbol.toPrimitive];
|
|
7344
|
+
if (void 0 !== e) {
|
|
7345
|
+
var i = e.call(t, r || "default");
|
|
7346
|
+
if ("object" != typeof i)
|
|
7347
|
+
return i;
|
|
7365
7348
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7366
7349
|
}
|
|
7367
|
-
return (
|
|
7350
|
+
return ("string" === r ? String : Number)(t);
|
|
7368
7351
|
}
|
|
7369
7352
|
class CellRenderer {
|
|
7370
7353
|
constructor() {
|
|
@@ -7424,30 +7407,24 @@ const CellRenderer$1 = CellRenderer;
|
|
|
7424
7407
|
function isDataBarGridModel(model) {
|
|
7425
7408
|
return (model === null || model === void 0 ? void 0 : model.dataBarOptionsForCell) !== void 0;
|
|
7426
7409
|
}
|
|
7427
|
-
function _defineProperty$2(
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
var
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
return input;
|
|
7443
|
-
var prim = input[Symbol.toPrimitive];
|
|
7444
|
-
if (prim !== void 0) {
|
|
7445
|
-
var res = prim.call(input, hint || "default");
|
|
7446
|
-
if (typeof res !== "object")
|
|
7447
|
-
return res;
|
|
7410
|
+
function _defineProperty$2(e, r, t) {
|
|
7411
|
+
return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
7412
|
+
}
|
|
7413
|
+
function _toPropertyKey$2(t) {
|
|
7414
|
+
var i = _toPrimitive$2(t, "string");
|
|
7415
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7416
|
+
}
|
|
7417
|
+
function _toPrimitive$2(t, r) {
|
|
7418
|
+
if ("object" != typeof t || !t)
|
|
7419
|
+
return t;
|
|
7420
|
+
var e = t[Symbol.toPrimitive];
|
|
7421
|
+
if (void 0 !== e) {
|
|
7422
|
+
var i = e.call(t, r || "default");
|
|
7423
|
+
if ("object" != typeof i)
|
|
7424
|
+
return i;
|
|
7448
7425
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7449
7426
|
}
|
|
7450
|
-
return (
|
|
7427
|
+
return ("string" === r ? String : Number)(t);
|
|
7451
7428
|
}
|
|
7452
7429
|
class DataBarCellRenderer extends CellRenderer$1 {
|
|
7453
7430
|
constructor() {
|
|
@@ -7801,30 +7778,24 @@ _defineProperty$2(DataBarCellRenderer, "getGradient", memoizeClear$1((width, col
|
|
|
7801
7778
|
// Stringify the arguments for memoization. Lets the color arrays be different arrays in memory, but still cache hit
|
|
7802
7779
|
}));
|
|
7803
7780
|
const DataBarCellRenderer$1 = DataBarCellRenderer;
|
|
7804
|
-
function _defineProperty$1(
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
var
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
return input;
|
|
7820
|
-
var prim = input[Symbol.toPrimitive];
|
|
7821
|
-
if (prim !== void 0) {
|
|
7822
|
-
var res = prim.call(input, hint || "default");
|
|
7823
|
-
if (typeof res !== "object")
|
|
7824
|
-
return res;
|
|
7781
|
+
function _defineProperty$1(e, r, t) {
|
|
7782
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
7783
|
+
}
|
|
7784
|
+
function _toPropertyKey$1(t) {
|
|
7785
|
+
var i = _toPrimitive$1(t, "string");
|
|
7786
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7787
|
+
}
|
|
7788
|
+
function _toPrimitive$1(t, r) {
|
|
7789
|
+
if ("object" != typeof t || !t)
|
|
7790
|
+
return t;
|
|
7791
|
+
var e = t[Symbol.toPrimitive];
|
|
7792
|
+
if (void 0 !== e) {
|
|
7793
|
+
var i = e.call(t, r || "default");
|
|
7794
|
+
if ("object" != typeof i)
|
|
7795
|
+
return i;
|
|
7825
7796
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7826
7797
|
}
|
|
7827
|
-
return (
|
|
7798
|
+
return ("string" === r ? String : Number)(t);
|
|
7828
7799
|
}
|
|
7829
7800
|
class TextCellRenderer extends CellRenderer$1 {
|
|
7830
7801
|
constructor() {
|
|
@@ -8009,30 +7980,24 @@ class TextCellRenderer extends CellRenderer$1 {
|
|
|
8009
7980
|
*/
|
|
8010
7981
|
}
|
|
8011
7982
|
const TextCellRenderer$1 = TextCellRenderer;
|
|
8012
|
-
function _defineProperty(
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
var
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
return input;
|
|
8028
|
-
var prim = input[Symbol.toPrimitive];
|
|
8029
|
-
if (prim !== void 0) {
|
|
8030
|
-
var res = prim.call(input, hint || "default");
|
|
8031
|
-
if (typeof res !== "object")
|
|
8032
|
-
return res;
|
|
7983
|
+
function _defineProperty(e, r, t) {
|
|
7984
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
7985
|
+
}
|
|
7986
|
+
function _toPropertyKey(t) {
|
|
7987
|
+
var i = _toPrimitive(t, "string");
|
|
7988
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7989
|
+
}
|
|
7990
|
+
function _toPrimitive(t, r) {
|
|
7991
|
+
if ("object" != typeof t || !t)
|
|
7992
|
+
return t;
|
|
7993
|
+
var e = t[Symbol.toPrimitive];
|
|
7994
|
+
if (void 0 !== e) {
|
|
7995
|
+
var i = e.call(t, r || "default");
|
|
7996
|
+
if ("object" != typeof i)
|
|
7997
|
+
return i;
|
|
8033
7998
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
8034
7999
|
}
|
|
8035
|
-
return (
|
|
8000
|
+
return ("string" === r ? String : Number)(t);
|
|
8036
8001
|
}
|
|
8037
8002
|
class GridRenderer {
|
|
8038
8003
|
constructor() {
|
|
@@ -9020,7 +8985,8 @@ class GridRenderer {
|
|
|
9020
8985
|
var columnIndex = startIndex;
|
|
9021
8986
|
while (columnIndex <= endIndex) {
|
|
9022
8987
|
var {
|
|
9023
|
-
columnCount
|
|
8988
|
+
columnCount,
|
|
8989
|
+
calculatedColumnWidths
|
|
9024
8990
|
} = metrics;
|
|
9025
8991
|
var modelColumn = getOrThrow(modelColumns, columnIndex);
|
|
9026
8992
|
var columnGroupName = model.textForColumnHeader(modelColumn, depth);
|
|
@@ -9030,23 +8996,23 @@ class GridRenderer {
|
|
|
9030
8996
|
if (columnGroupName != null) {
|
|
9031
8997
|
var prevColumnIndex = columnIndex - 1;
|
|
9032
8998
|
while (prevColumnIndex >= 0 && (columnGroupRight - columnGroupLeft < visibleWidth || columnGroupLeft > minX)) {
|
|
9033
|
-
var _modelColumns$get, _ref3, _userColumnWidths$get;
|
|
8999
|
+
var _modelColumns$get, _ref3, _ref4, _userColumnWidths$get;
|
|
9034
9000
|
var prevModelIndex = (_modelColumns$get = modelColumns.get(prevColumnIndex)) !== null && _modelColumns$get !== void 0 ? _modelColumns$get : GridUtils.getModelIndex(prevColumnIndex, movedColumns);
|
|
9035
9001
|
if (prevModelIndex == null || model.textForColumnHeader(prevModelIndex, depth) !== columnGroupName) {
|
|
9036
9002
|
break;
|
|
9037
9003
|
}
|
|
9038
|
-
var prevColumnWidth = (_ref3 = (_userColumnWidths$get = userColumnWidths.get(prevModelIndex)) !== null && _userColumnWidths$get !== void 0 ? _userColumnWidths$get : allColumnWidths.get(prevColumnIndex)) !== null && _ref3 !== void 0 ? _ref3 : columnWidth;
|
|
9004
|
+
var prevColumnWidth = (_ref3 = (_ref4 = (_userColumnWidths$get = userColumnWidths.get(prevModelIndex)) !== null && _userColumnWidths$get !== void 0 ? _userColumnWidths$get : allColumnWidths.get(prevColumnIndex)) !== null && _ref4 !== void 0 ? _ref4 : calculatedColumnWidths.get(prevModelIndex)) !== null && _ref3 !== void 0 ? _ref3 : columnWidth;
|
|
9039
9005
|
columnGroupLeft -= prevColumnWidth;
|
|
9040
9006
|
prevColumnIndex -= 1;
|
|
9041
9007
|
}
|
|
9042
9008
|
var nextColumnIndex = columnIndex + 1;
|
|
9043
9009
|
while (nextColumnIndex < columnCount && (columnGroupRight - columnGroupLeft < visibleWidth || columnGroupRight < maxX)) {
|
|
9044
|
-
var _modelColumns$get2,
|
|
9010
|
+
var _modelColumns$get2, _ref5, _userColumnWidths$get2;
|
|
9045
9011
|
var nextModelIndex = (_modelColumns$get2 = modelColumns.get(nextColumnIndex)) !== null && _modelColumns$get2 !== void 0 ? _modelColumns$get2 : GridUtils.getModelIndex(nextColumnIndex, movedColumns);
|
|
9046
9012
|
if (model.textForColumnHeader(nextModelIndex, depth) !== columnGroupName) {
|
|
9047
9013
|
break;
|
|
9048
9014
|
}
|
|
9049
|
-
var nextColumnWidth = (
|
|
9015
|
+
var nextColumnWidth = (_ref5 = (_userColumnWidths$get2 = userColumnWidths.get(nextModelIndex)) !== null && _userColumnWidths$get2 !== void 0 ? _userColumnWidths$get2 : allColumnWidths.get(nextColumnIndex)) !== null && _ref5 !== void 0 ? _ref5 : columnWidth;
|
|
9050
9016
|
columnGroupRight += nextColumnWidth;
|
|
9051
9017
|
nextColumnIndex += 1;
|
|
9052
9018
|
}
|
|
@@ -9957,6 +9923,16 @@ class PivotColumnHeaderGroup extends irisGrid.ColumnHeaderGroup {
|
|
|
9957
9923
|
function isCorePlusDh(dh) {
|
|
9958
9924
|
return "coreplus" in dh;
|
|
9959
9925
|
}
|
|
9926
|
+
function getKeyColumnGroups(model) {
|
|
9927
|
+
const keyColumnGroups = [];
|
|
9928
|
+
for (let depth = 0; depth <= model.columnHeaderMaxDepth; depth += 1) {
|
|
9929
|
+
const group = model.getColumnHeaderGroup(0, depth);
|
|
9930
|
+
if (isPivotColumnHeaderGroup(group) && group.isKeyColumnGroup) {
|
|
9931
|
+
keyColumnGroups.push(group);
|
|
9932
|
+
}
|
|
9933
|
+
}
|
|
9934
|
+
return keyColumnGroups;
|
|
9935
|
+
}
|
|
9960
9936
|
const GRAND_TOTALS_GROUP_NAME = "Grand Total";
|
|
9961
9937
|
const TOTALS_GROUP_NAME = "Total";
|
|
9962
9938
|
const ROOT_DEPTH = 2;
|
|
@@ -9972,6 +9948,7 @@ function makeColumn({
|
|
|
9972
9948
|
type,
|
|
9973
9949
|
index,
|
|
9974
9950
|
description,
|
|
9951
|
+
isFilterable = false,
|
|
9975
9952
|
isSortable = false,
|
|
9976
9953
|
depth = ROOT_DEPTH,
|
|
9977
9954
|
hasChildren = false,
|
|
@@ -9989,6 +9966,7 @@ function makeColumn({
|
|
|
9989
9966
|
displayName,
|
|
9990
9967
|
type,
|
|
9991
9968
|
isPartitionColumn: false,
|
|
9969
|
+
isFilterable,
|
|
9992
9970
|
isSortable,
|
|
9993
9971
|
isProxy,
|
|
9994
9972
|
description,
|
|
@@ -10065,10 +10043,12 @@ function makePlaceholderColumn(valueSource, originalIndex, offset) {
|
|
|
10065
10043
|
}
|
|
10066
10044
|
function makeColumnFromSource(source, index) {
|
|
10067
10045
|
const { name, type, isSortable, description } = source;
|
|
10046
|
+
const isFilterable = true;
|
|
10068
10047
|
return makeColumn({
|
|
10069
10048
|
name,
|
|
10070
10049
|
type,
|
|
10071
10050
|
index,
|
|
10051
|
+
isFilterable,
|
|
10072
10052
|
isSortable,
|
|
10073
10053
|
description,
|
|
10074
10054
|
filter: source.filter.bind(source),
|
|
@@ -10192,7 +10172,7 @@ function makeColumnGroups(pivotTable, snapshotColumns, isRootColumnExpanded = tr
|
|
|
10192
10172
|
);
|
|
10193
10173
|
return [...virtualColumnGroups, ...snapshotColumnGroups];
|
|
10194
10174
|
}
|
|
10195
|
-
const log$
|
|
10175
|
+
const log$4 = Log.module("@deephaven/js-plugin-pivot/IrisGridPivotModel");
|
|
10196
10176
|
const SET_VIEWPORT_THROTTLE = 150;
|
|
10197
10177
|
const APPLY_VIEWPORT_THROTTLE = 0;
|
|
10198
10178
|
const ROW_BUFFER_PAGES = 1;
|
|
@@ -10342,7 +10322,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10342
10322
|
return this.dh.RangeSet.ofRange(0, totalColumnCount);
|
|
10343
10323
|
}
|
|
10344
10324
|
if (viewportColumns.length === 0) {
|
|
10345
|
-
log$
|
|
10325
|
+
log$4.debug(
|
|
10346
10326
|
"Empty viewport columns, returning minimal range",
|
|
10347
10327
|
viewportColumns
|
|
10348
10328
|
);
|
|
@@ -10365,7 +10345,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10365
10345
|
) ?? 0
|
|
10366
10346
|
);
|
|
10367
10347
|
if (minIndex > maxIndex) {
|
|
10368
|
-
log$
|
|
10348
|
+
log$4.warn(
|
|
10369
10349
|
"Invalid column range, minIndex > maxIndex",
|
|
10370
10350
|
viewportColumns,
|
|
10371
10351
|
minIndex,
|
|
@@ -10385,12 +10365,12 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10385
10365
|
__publicField(this, "setViewport", lodash_throttle(
|
|
10386
10366
|
(top, bottom, columns) => {
|
|
10387
10367
|
if (bottom < top) {
|
|
10388
|
-
log$
|
|
10368
|
+
log$4.error("Invalid viewport", top, bottom);
|
|
10389
10369
|
return;
|
|
10390
10370
|
}
|
|
10391
10371
|
const { viewport } = this;
|
|
10392
10372
|
if (viewport != null && viewport.top === top && viewport.bottom === bottom && viewport.columns === columns) {
|
|
10393
|
-
log$
|
|
10373
|
+
log$4.debug2("Ignoring duplicate viewport", viewport);
|
|
10394
10374
|
return;
|
|
10395
10375
|
}
|
|
10396
10376
|
this.viewport = {
|
|
@@ -10398,7 +10378,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10398
10378
|
bottom,
|
|
10399
10379
|
columns
|
|
10400
10380
|
};
|
|
10401
|
-
log$
|
|
10381
|
+
log$4.debug2("setViewport", this.viewport);
|
|
10402
10382
|
this.applyViewport();
|
|
10403
10383
|
},
|
|
10404
10384
|
SET_VIEWPORT_THROTTLE
|
|
@@ -10419,7 +10399,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10419
10399
|
if (!this.viewport) {
|
|
10420
10400
|
return;
|
|
10421
10401
|
}
|
|
10422
|
-
log$
|
|
10402
|
+
log$4.debug2("applyViewport", this.viewport);
|
|
10423
10403
|
const { top, bottom, columns } = this.viewport;
|
|
10424
10404
|
const [viewportTop, viewportBottom] = this.getCachedViewportRowRange(
|
|
10425
10405
|
top,
|
|
@@ -10453,9 +10433,12 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10453
10433
|
};
|
|
10454
10434
|
}
|
|
10455
10435
|
get filter() {
|
|
10456
|
-
return
|
|
10436
|
+
return this.pivotTable.filter;
|
|
10457
10437
|
}
|
|
10458
|
-
set filter(
|
|
10438
|
+
set filter(filters) {
|
|
10439
|
+
log$4.debug2("Setting filter on pivot table", filters);
|
|
10440
|
+
this.pivotTable.applyFilter(filters);
|
|
10441
|
+
this.applyViewport();
|
|
10459
10442
|
}
|
|
10460
10443
|
hydratePivotSort(sort) {
|
|
10461
10444
|
const sourceIndex = this.getColumnIndexByName(sort.column.name);
|
|
@@ -10466,19 +10449,19 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10466
10449
|
return this._sorts ?? EMPTY_ARRAY;
|
|
10467
10450
|
}
|
|
10468
10451
|
set sort(sorts) {
|
|
10469
|
-
log$
|
|
10452
|
+
log$4.debug("Setting sorts on pivot table", sorts);
|
|
10470
10453
|
this._sorts = sorts;
|
|
10471
10454
|
const columnBySorts = [];
|
|
10472
10455
|
const rowBySorts = [];
|
|
10473
10456
|
sorts.forEach((s) => {
|
|
10474
10457
|
const sort = this.hydratePivotSort(s);
|
|
10475
10458
|
if (sort == null) {
|
|
10476
|
-
log$
|
|
10459
|
+
log$4.warn(`Cannot hydrate sort for source: ${s.column.name}`, s);
|
|
10477
10460
|
return;
|
|
10478
10461
|
}
|
|
10479
10462
|
const index = this.getColumnIndexByName(sort.name);
|
|
10480
10463
|
if (index == null) {
|
|
10481
|
-
log$
|
|
10464
|
+
log$4.warn(`Cannot find index for source: ${s.column.name}`, s);
|
|
10482
10465
|
return;
|
|
10483
10466
|
}
|
|
10484
10467
|
if (index < 0) {
|
|
@@ -10684,7 +10667,8 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10684
10667
|
return false;
|
|
10685
10668
|
}
|
|
10686
10669
|
isFilterable(columnIndex) {
|
|
10687
|
-
|
|
10670
|
+
var _a;
|
|
10671
|
+
return ((_a = this.columns[columnIndex]) == null ? void 0 : _a.isFilterable) ?? false;
|
|
10688
10672
|
}
|
|
10689
10673
|
isColumnSortable(columnIndex) {
|
|
10690
10674
|
var _a;
|
|
@@ -10740,7 +10724,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10740
10724
|
}
|
|
10741
10725
|
}
|
|
10742
10726
|
handleModelEvent(event) {
|
|
10743
|
-
log$
|
|
10727
|
+
log$4.debug2("handleModelEvent", event);
|
|
10744
10728
|
const { detail, type } = event;
|
|
10745
10729
|
this.dispatchEvent(new EventShimCustomEvent(type, { detail }));
|
|
10746
10730
|
}
|
|
@@ -10754,7 +10738,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10754
10738
|
this.formattedStringData = [];
|
|
10755
10739
|
this.viewportData = this.extractSnapshotData(snapshot);
|
|
10756
10740
|
this.updatePendingExpandCollapseState();
|
|
10757
|
-
log$
|
|
10741
|
+
log$4.debug2("Pivot updated", {
|
|
10758
10742
|
columns: this.columns,
|
|
10759
10743
|
snapshot,
|
|
10760
10744
|
snapshotColumns: this.snapshotColumns,
|
|
@@ -10769,7 +10753,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10769
10753
|
})
|
|
10770
10754
|
);
|
|
10771
10755
|
} else {
|
|
10772
|
-
log$
|
|
10756
|
+
log$4.debug2("Pivot columns did not change in the update");
|
|
10773
10757
|
}
|
|
10774
10758
|
this.dispatchEvent(new EventShimCustomEvent(irisGrid.IrisGridModel.EVENT.UPDATED));
|
|
10775
10759
|
}
|
|
@@ -10919,7 +10903,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
10919
10903
|
}
|
|
10920
10904
|
}
|
|
10921
10905
|
close() {
|
|
10922
|
-
log$
|
|
10906
|
+
log$4.debug("close");
|
|
10923
10907
|
this.pivotTable.close();
|
|
10924
10908
|
}
|
|
10925
10909
|
get formatter() {
|
|
@@ -11011,11 +10995,11 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
11011
10995
|
return true;
|
|
11012
10996
|
}
|
|
11013
10997
|
expandAllColumns() {
|
|
11014
|
-
log$
|
|
10998
|
+
log$4.debug("expandAllColumns");
|
|
11015
10999
|
this.setColumnExpanded(this.keyColumns.length, true, true);
|
|
11016
11000
|
}
|
|
11017
11001
|
collapseAllColumns() {
|
|
11018
|
-
log$
|
|
11002
|
+
log$4.debug("collapseAllColumns");
|
|
11019
11003
|
this.setColumnExpanded(this.keyColumns.length, false, true);
|
|
11020
11004
|
}
|
|
11021
11005
|
isColumnExpandable(x, depth) {
|
|
@@ -11040,7 +11024,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
11040
11024
|
return ((_a = this.columns[x]) == null ? void 0 : _a.isExpanded) ?? false;
|
|
11041
11025
|
}
|
|
11042
11026
|
setColumnExpanded(x, isExpanded, expandDescendants = false) {
|
|
11043
|
-
log$
|
|
11027
|
+
log$4.debug2("setColumnExpanded", {
|
|
11044
11028
|
x,
|
|
11045
11029
|
isExpanded,
|
|
11046
11030
|
expandDescendants
|
|
@@ -11059,7 +11043,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
11059
11043
|
return depth;
|
|
11060
11044
|
}
|
|
11061
11045
|
textValueForCell(x, y) {
|
|
11062
|
-
var _a;
|
|
11046
|
+
var _a, _b;
|
|
11063
11047
|
if (((_a = this.formattedStringData[x]) == null ? void 0 : _a[y]) === void 0) {
|
|
11064
11048
|
const value2 = this.valueForCell(x, y);
|
|
11065
11049
|
if (value2 === null) {
|
|
@@ -11069,10 +11053,22 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
11069
11053
|
return void 0;
|
|
11070
11054
|
}
|
|
11071
11055
|
const column = this.columns[x];
|
|
11056
|
+
let columnType = column.type;
|
|
11057
|
+
let columnName = column.name;
|
|
11058
|
+
const groupOffset = this.groupColumn == null ? 0 : 1;
|
|
11059
|
+
if (groupOffset === 1 && x === 0 && y !== 0) {
|
|
11060
|
+
const rowDepth = ((_b = this.row(y)) == null ? void 0 : _b.depth) ?? 2;
|
|
11061
|
+
const keyCount = this.keyColumns.length;
|
|
11062
|
+
if (rowDepth > 0 && rowDepth < keyCount) {
|
|
11063
|
+
const sourceKeyColumn = this.keyColumns[rowDepth - 1];
|
|
11064
|
+
columnType = sourceKeyColumn.type;
|
|
11065
|
+
columnName = sourceKeyColumn.name;
|
|
11066
|
+
}
|
|
11067
|
+
}
|
|
11072
11068
|
const hasCustomColumnFormat = this.getCachedCustomColumnFormatFlag(
|
|
11073
11069
|
this.formatter,
|
|
11074
|
-
|
|
11075
|
-
|
|
11070
|
+
columnName,
|
|
11071
|
+
columnType
|
|
11076
11072
|
);
|
|
11077
11073
|
let formatOverride;
|
|
11078
11074
|
if (!hasCustomColumnFormat) {
|
|
@@ -11083,8 +11079,8 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
11083
11079
|
}
|
|
11084
11080
|
const text = this.displayString(
|
|
11085
11081
|
value2,
|
|
11086
|
-
|
|
11087
|
-
|
|
11082
|
+
columnType,
|
|
11083
|
+
columnName,
|
|
11088
11084
|
formatOverride
|
|
11089
11085
|
);
|
|
11090
11086
|
this.cacheFormattedValue(x, y, text);
|
|
@@ -11174,7 +11170,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
|
|
|
11174
11170
|
this.virtualColumns.length,
|
|
11175
11171
|
this.snapshotValueSources.length
|
|
11176
11172
|
);
|
|
11177
|
-
log$
|
|
11173
|
+
log$4.debug2("applyBufferedViewport", {
|
|
11178
11174
|
top,
|
|
11179
11175
|
bottom,
|
|
11180
11176
|
columns,
|
|
@@ -11253,17 +11249,17 @@ function useIrisGridPivotModel(fetch) {
|
|
|
11253
11249
|
}
|
|
11254
11250
|
throw new Error("Invalid state");
|
|
11255
11251
|
}
|
|
11256
|
-
const log$
|
|
11252
|
+
const log$3 = Log.module("@deephaven/js-plugin-pivot/usePivotTableFetch");
|
|
11257
11253
|
function usePivotTableFetch(fetch) {
|
|
11258
11254
|
const api = jsapiBootstrap.useApi();
|
|
11259
11255
|
return React.useCallback(
|
|
11260
11256
|
() => fetch().then((widget) => {
|
|
11261
|
-
log$
|
|
11257
|
+
log$3.debug("Pivot fetch result:", widget);
|
|
11262
11258
|
if (!isCorePlusDh(api)) {
|
|
11263
11259
|
throw new Error("CorePlus is not available");
|
|
11264
11260
|
}
|
|
11265
11261
|
const pivotTable = new api.coreplus.pivot.PivotTable(widget);
|
|
11266
|
-
log$
|
|
11262
|
+
log$3.debug("Created pivot table:", pivotTable);
|
|
11267
11263
|
return pivotTable;
|
|
11268
11264
|
}),
|
|
11269
11265
|
[api, fetch]
|
|
@@ -11321,41 +11317,276 @@ class PivotColumnGroupMouseHandler extends GridMouseHandler {
|
|
|
11321
11317
|
return false;
|
|
11322
11318
|
}
|
|
11323
11319
|
}
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11320
|
+
function getColumnWidth(column, metrics, themeColumnWidth) {
|
|
11321
|
+
const {
|
|
11322
|
+
firstColumn,
|
|
11323
|
+
allColumnWidths,
|
|
11324
|
+
calculatedColumnWidths,
|
|
11325
|
+
userColumnWidths,
|
|
11326
|
+
treePaddingX
|
|
11327
|
+
} = metrics;
|
|
11328
|
+
const modelColumn = GridUtils.getModelIndex(column, metrics.movedColumns);
|
|
11329
|
+
return userColumnWidths.get(modelColumn) ?? allColumnWidths.get(column) ?? (calculatedColumnWidths.has(modelColumn) ? (calculatedColumnWidths.get(modelColumn) ?? 0) + (column === firstColumn ? treePaddingX : 0) : void 0) ?? themeColumnWidth;
|
|
11330
|
+
}
|
|
11331
|
+
function getColumnHeaderCoordinates(state, group) {
|
|
11332
|
+
const { metrics, theme } = state;
|
|
11333
|
+
const { childIndexes, depth } = group;
|
|
11334
|
+
const firstChildIndex = childIndexes[0];
|
|
11335
|
+
const lastChildIndex = childIndexes[childIndexes.length - 1];
|
|
11336
|
+
if (firstChildIndex == null || lastChildIndex == null) {
|
|
11337
|
+
throw new Error("Group has no child columns");
|
|
11338
|
+
}
|
|
11339
|
+
const { left, right, allColumnXs, allColumnWidths, gridX, gridY } = metrics;
|
|
11340
|
+
const {
|
|
11341
|
+
filterBarHeight,
|
|
11342
|
+
columnHeaderHeight,
|
|
11343
|
+
columnWidth: themeColumnWidth
|
|
11344
|
+
} = theme;
|
|
11345
|
+
const firstVisible = Math.max(left, firstChildIndex);
|
|
11346
|
+
const lastVisible = Math.min(right, lastChildIndex);
|
|
11347
|
+
if (firstVisible > lastChildIndex || lastVisible < firstChildIndex) {
|
|
11348
|
+
return null;
|
|
11349
|
+
}
|
|
11350
|
+
const firstVisibleX = allColumnXs.get(firstVisible);
|
|
11351
|
+
if (firstVisibleX == null) {
|
|
11352
|
+
return null;
|
|
11353
|
+
}
|
|
11354
|
+
let groupX1 = firstVisibleX;
|
|
11355
|
+
for (let i = firstChildIndex; i < firstVisible; i += 1) {
|
|
11356
|
+
groupX1 -= getColumnWidth(i, metrics, themeColumnWidth);
|
|
11357
|
+
}
|
|
11358
|
+
const lastColumnX = allColumnXs.get(lastVisible);
|
|
11359
|
+
const lastColumnWidth = allColumnWidths.get(lastVisible);
|
|
11360
|
+
if (lastColumnX == null || lastColumnWidth == null) {
|
|
11361
|
+
return null;
|
|
11362
|
+
}
|
|
11363
|
+
let groupX2 = lastColumnX + lastColumnWidth;
|
|
11364
|
+
for (let i = lastVisible + 1; i <= lastChildIndex; i += 1) {
|
|
11365
|
+
groupX2 += getColumnWidth(i, metrics, themeColumnWidth);
|
|
11366
|
+
}
|
|
11367
|
+
return {
|
|
11368
|
+
x1: gridX + groupX1,
|
|
11369
|
+
y1: gridY - filterBarHeight - (depth + 1) * columnHeaderHeight,
|
|
11370
|
+
x2: gridX + groupX2,
|
|
11371
|
+
y2: gridY - filterBarHeight - depth * columnHeaderHeight
|
|
11372
|
+
};
|
|
11373
|
+
}
|
|
11374
|
+
class IrisGridPivotMetricCalculator extends irisGrid.IrisGridMetricCalculator {
|
|
11375
|
+
constructor() {
|
|
11376
|
+
super(...arguments);
|
|
11377
|
+
// Initialize with null to ensure the first check always triggers reset
|
|
11378
|
+
__publicField(this, "cachedIsFilterBarShown", null);
|
|
11379
|
+
__publicField(this, "getCachedColumnSourceLabelWidth", memoizeOne(
|
|
11380
|
+
(keyColumnGroups, headerHorizontalPadding, maxColumnWidth, state) => {
|
|
11381
|
+
let result = 0;
|
|
11382
|
+
keyColumnGroups.forEach((group) => {
|
|
11383
|
+
const sourceIndex = -group.depth;
|
|
11384
|
+
const width = this.getColumnHeaderGroupWidth(
|
|
11385
|
+
sourceIndex,
|
|
11386
|
+
0,
|
|
11387
|
+
state,
|
|
11388
|
+
maxColumnWidth
|
|
11389
|
+
);
|
|
11390
|
+
result = Math.max(result, width + headerHorizontalPadding);
|
|
11391
|
+
});
|
|
11392
|
+
return result;
|
|
11393
|
+
}
|
|
11394
|
+
));
|
|
11331
11395
|
}
|
|
11332
11396
|
/**
|
|
11333
|
-
*
|
|
11334
|
-
*
|
|
11335
|
-
* @
|
|
11397
|
+
* Resets column width caches if filter bar visibility has changed
|
|
11398
|
+
* to adjust for the minimum filter box width.
|
|
11399
|
+
* @param state The current IrisGridPivotMetricState
|
|
11336
11400
|
*/
|
|
11337
|
-
|
|
11338
|
-
const {
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11401
|
+
resetHeaderWidthsIfFilterBarChanged(state) {
|
|
11402
|
+
const { isFilterBarShown } = state;
|
|
11403
|
+
if (this.cachedIsFilterBarShown !== isFilterBarShown) {
|
|
11404
|
+
this.resetCalculatedHeaderGroupWidths();
|
|
11405
|
+
}
|
|
11406
|
+
this.cachedIsFilterBarShown = isFilterBarShown;
|
|
11407
|
+
}
|
|
11408
|
+
getColumnHeaderGroupWidth(modelColumn, depth, state, maxColumnWidth) {
|
|
11409
|
+
const baseWidth = super.getColumnHeaderGroupWidth(
|
|
11410
|
+
modelColumn,
|
|
11411
|
+
depth,
|
|
11412
|
+
state,
|
|
11413
|
+
maxColumnWidth
|
|
11414
|
+
);
|
|
11415
|
+
const { isFilterBarShown, model } = state;
|
|
11416
|
+
if (!isFilterBarShown) {
|
|
11417
|
+
return baseWidth;
|
|
11418
|
+
}
|
|
11419
|
+
const group = model.getColumnHeaderGroup(modelColumn, depth);
|
|
11420
|
+
if (!isPivotColumnHeaderGroup(group) || !group.isKeyColumnGroup) {
|
|
11421
|
+
return baseWidth;
|
|
11422
|
+
}
|
|
11423
|
+
const { theme } = state;
|
|
11424
|
+
const { columnSourceFilterMinWidth } = theme;
|
|
11425
|
+
return baseWidth + columnSourceFilterMinWidth;
|
|
11426
|
+
}
|
|
11427
|
+
/**
|
|
11428
|
+
* Calculate the width needed for the column source labels
|
|
11429
|
+
* @param model The IrisGridPivotModel instance
|
|
11430
|
+
* @param state The current IrisGridPivotMetricState
|
|
11431
|
+
* @returns The calculated width for the column source labels
|
|
11432
|
+
*/
|
|
11433
|
+
calculateColumnSourceLabelWidth(model, state) {
|
|
11434
|
+
const { theme } = state;
|
|
11435
|
+
const { headerHorizontalPadding, maxColumnWidth } = theme;
|
|
11436
|
+
const keyColumnGroups = getKeyColumnGroups(model);
|
|
11437
|
+
return this.getCachedColumnSourceLabelWidth(
|
|
11438
|
+
keyColumnGroups,
|
|
11439
|
+
headerHorizontalPadding,
|
|
11440
|
+
maxColumnWidth,
|
|
11441
|
+
state
|
|
11442
|
+
);
|
|
11443
|
+
}
|
|
11444
|
+
/**
|
|
11445
|
+
* Gets the metrics for the current state. This method has to be called before setColumnSize or resetColumnSize.
|
|
11446
|
+
* @param state The current IrisGridPivotMetricState
|
|
11447
|
+
* @returns The metrics for the current state
|
|
11448
|
+
*/
|
|
11449
|
+
getMetrics(state) {
|
|
11450
|
+
const { model } = state;
|
|
11451
|
+
if (!isIrisGridPivotModel(model)) {
|
|
11452
|
+
throw new Error("Model is not an IrisGridPivotModel");
|
|
11453
|
+
}
|
|
11454
|
+
const columnSourceLabelWidth = this.calculateColumnSourceLabelWidth(
|
|
11455
|
+
model,
|
|
11456
|
+
state
|
|
11457
|
+
);
|
|
11458
|
+
this.resetHeaderWidthsIfFilterBarChanged(state);
|
|
11459
|
+
return {
|
|
11460
|
+
...super.getMetrics(state),
|
|
11461
|
+
columnSourceLabelWidth
|
|
11462
|
+
};
|
|
11463
|
+
}
|
|
11464
|
+
/**
|
|
11465
|
+
* Get metrics for positioning the filter bar input field.
|
|
11466
|
+
* @param index The visible index of the column to get the filter box coordinates for
|
|
11467
|
+
* @param state The current IrisGridMetricState
|
|
11468
|
+
* @param metrics The grid metrics
|
|
11469
|
+
* @returns Coordinates for the filter input field, or null if positioning cannot be calculated
|
|
11470
|
+
*/
|
|
11471
|
+
// eslint-disable-next-line class-methods-use-this
|
|
11472
|
+
getFilterInputCoordinates(index, state, metrics) {
|
|
11473
|
+
if (index >= 0) {
|
|
11474
|
+
return super.getFilterInputCoordinates(index, state, metrics);
|
|
11475
|
+
}
|
|
11476
|
+
const { model, theme } = state;
|
|
11477
|
+
if (!isIrisGridPivotModel(model)) {
|
|
11343
11478
|
return null;
|
|
11344
11479
|
}
|
|
11345
|
-
const
|
|
11346
|
-
|
|
11347
|
-
|
|
11480
|
+
const { gridY, columnSourceLabelWidth } = metrics;
|
|
11481
|
+
const { columnSourceFilterMinWidth, filterBarHeight } = theme;
|
|
11482
|
+
const depth = -index;
|
|
11483
|
+
const keyColumnGroup = model.getColumnHeaderGroup(0, depth);
|
|
11484
|
+
if (keyColumnGroup == null || !isPivotColumnHeaderGroup(keyColumnGroup) || !keyColumnGroup.isKeyColumnGroup) {
|
|
11485
|
+
return null;
|
|
11348
11486
|
}
|
|
11487
|
+
const groupCoords = getColumnHeaderCoordinates(
|
|
11488
|
+
{ metrics, theme, model },
|
|
11489
|
+
keyColumnGroup
|
|
11490
|
+
);
|
|
11491
|
+
if (groupCoords == null) {
|
|
11492
|
+
return null;
|
|
11493
|
+
}
|
|
11494
|
+
const { x1, x2 } = groupCoords;
|
|
11495
|
+
const columnSourceFilterWidth = Math.max(
|
|
11496
|
+
columnSourceFilterMinWidth,
|
|
11497
|
+
x2 - x1 - columnSourceLabelWidth
|
|
11498
|
+
);
|
|
11499
|
+
const x = x2 - columnSourceFilterWidth;
|
|
11500
|
+
const y = gridY - theme.columnHeaderHeight - (1 - index) * (filterBarHeight ?? 0);
|
|
11501
|
+
return {
|
|
11502
|
+
x,
|
|
11503
|
+
y,
|
|
11504
|
+
width: columnSourceFilterWidth + 1,
|
|
11505
|
+
// cover right border
|
|
11506
|
+
height: (filterBarHeight ?? 0) - 1
|
|
11507
|
+
// remove bottom border
|
|
11508
|
+
};
|
|
11509
|
+
}
|
|
11510
|
+
/**
|
|
11511
|
+
* Calculate the new left index to bring the given column into view.
|
|
11512
|
+
* @param column The column that should be scrolled into view
|
|
11513
|
+
* @param state The current IrisGridMetricState
|
|
11514
|
+
* @param metrics The grid metrics
|
|
11515
|
+
* @returns The left column index to scroll to, or null if no scroll is needed
|
|
11516
|
+
*/
|
|
11517
|
+
getScrollLeftForColumn(column, state, metrics) {
|
|
11518
|
+
if (column < 0) {
|
|
11519
|
+
return null;
|
|
11520
|
+
}
|
|
11521
|
+
return super.getScrollLeftForColumn(column, state, metrics);
|
|
11522
|
+
}
|
|
11523
|
+
}
|
|
11524
|
+
function getColumnSourceHeaderFromGridPoint(model, gridPoint) {
|
|
11525
|
+
const { column, row, columnHeaderDepth } = gridPoint;
|
|
11526
|
+
const sourceIndex = columnHeaderDepth != null ? -columnHeaderDepth : null;
|
|
11527
|
+
if (column == null || row !== null || columnHeaderDepth == null) {
|
|
11349
11528
|
return null;
|
|
11350
11529
|
}
|
|
11530
|
+
const group = model.getColumnHeaderGroup(column, columnHeaderDepth);
|
|
11531
|
+
if (sourceIndex != null && sourceIndex < 0 && isIrisGridPivotModel(model) && isPivotColumnHeaderGroup(group) && group.isKeyColumnGroup) {
|
|
11532
|
+
return sourceIndex;
|
|
11533
|
+
}
|
|
11534
|
+
return null;
|
|
11535
|
+
}
|
|
11536
|
+
function isGridPointInColumnSourceFilterBox(model, gridPoint, metrics, theme) {
|
|
11537
|
+
if (!isIrisGridPivotModel(model)) {
|
|
11538
|
+
return false;
|
|
11539
|
+
}
|
|
11540
|
+
const { column, row, columnHeaderDepth } = gridPoint;
|
|
11541
|
+
if (column == null || row !== null || columnHeaderDepth == null) {
|
|
11542
|
+
return false;
|
|
11543
|
+
}
|
|
11544
|
+
const sourceIndex = getColumnSourceHeaderFromGridPoint(model, gridPoint);
|
|
11545
|
+
if (sourceIndex == null) {
|
|
11546
|
+
return false;
|
|
11547
|
+
}
|
|
11548
|
+
const group = model.getColumnHeaderGroup(column, columnHeaderDepth);
|
|
11549
|
+
if (!isPivotColumnHeaderGroup(group)) {
|
|
11550
|
+
return false;
|
|
11551
|
+
}
|
|
11552
|
+
const coords = getColumnHeaderCoordinates(
|
|
11553
|
+
{ metrics, theme, model },
|
|
11554
|
+
group
|
|
11555
|
+
);
|
|
11556
|
+
if (coords == null) {
|
|
11557
|
+
return false;
|
|
11558
|
+
}
|
|
11559
|
+
const { columnSourceFilterMinWidth } = theme;
|
|
11560
|
+
const { columnSourceLabelWidth } = metrics;
|
|
11561
|
+
const { x1, x2 } = coords;
|
|
11562
|
+
const columnSourceFilterWidth = Math.max(
|
|
11563
|
+
x2 - x1 - columnSourceLabelWidth,
|
|
11564
|
+
columnSourceFilterMinWidth
|
|
11565
|
+
);
|
|
11566
|
+
return gridPoint.x > x2 - columnSourceFilterWidth;
|
|
11567
|
+
}
|
|
11568
|
+
const log$2 = Log.module("@deephaven/js-plugin-pivot/PivotSortMouseHandler");
|
|
11569
|
+
class PivotSortMouseHandler extends GridMouseHandler {
|
|
11570
|
+
constructor(irisGrid2) {
|
|
11571
|
+
super();
|
|
11572
|
+
__publicField(this, "columnSource");
|
|
11573
|
+
__publicField(this, "irisGrid");
|
|
11574
|
+
this.columnSource = null;
|
|
11575
|
+
this.irisGrid = irisGrid2;
|
|
11576
|
+
}
|
|
11351
11577
|
// We need to remember where the down started, because the canvas element will trigger a click where mouseUp is
|
|
11352
11578
|
onDown(gridPoint, grid, event) {
|
|
11353
|
-
|
|
11579
|
+
const { model } = this.irisGrid.props;
|
|
11580
|
+
assertNotNull(model);
|
|
11581
|
+
this.columnSource = getColumnSourceHeaderFromGridPoint(model, gridPoint);
|
|
11582
|
+
log$2.debug("onDown", gridPoint, this.columnSource);
|
|
11354
11583
|
return false;
|
|
11355
11584
|
}
|
|
11356
11585
|
onClick(gridPoint, grid, event) {
|
|
11357
|
-
const
|
|
11358
|
-
|
|
11586
|
+
const { model } = this.irisGrid.props;
|
|
11587
|
+
assertNotNull(model);
|
|
11588
|
+
const columnSource = getColumnSourceHeaderFromGridPoint(model, gridPoint);
|
|
11589
|
+
if (columnSource != null && columnSource === this.columnSource && model.isColumnSortable(columnSource)) {
|
|
11359
11590
|
const addToExisting = components.ContextActionUtils.isModifierKeyDown(event);
|
|
11360
11591
|
this.irisGrid.toggleSort(columnSource, addToExisting);
|
|
11361
11592
|
return true;
|
|
@@ -11363,10 +11594,55 @@ class PivotSortMouseHandler extends GridMouseHandler {
|
|
|
11363
11594
|
return false;
|
|
11364
11595
|
}
|
|
11365
11596
|
}
|
|
11597
|
+
function isPivotGridMetrics(metrics) {
|
|
11598
|
+
return metrics.columnSourceLabelWidth !== void 0;
|
|
11599
|
+
}
|
|
11600
|
+
class PivotFilterMouseHandler extends GridMouseHandler {
|
|
11601
|
+
constructor(irisGrid2) {
|
|
11602
|
+
super();
|
|
11603
|
+
__publicField(this, "irisGrid");
|
|
11604
|
+
this.irisGrid = irisGrid2;
|
|
11605
|
+
}
|
|
11606
|
+
onDown(gridPoint) {
|
|
11607
|
+
const { model } = this.irisGrid.props;
|
|
11608
|
+
const { isFilterBarShown, metrics } = this.irisGrid.state;
|
|
11609
|
+
const sourceIndex = getColumnSourceHeaderFromGridPoint(model, gridPoint);
|
|
11610
|
+
if (sourceIndex != null) {
|
|
11611
|
+
assertNotNull(metrics, "Metrics not set");
|
|
11612
|
+
if (!isPivotGridMetrics(metrics)) {
|
|
11613
|
+
throw new Error("PivotGridMetrics required");
|
|
11614
|
+
}
|
|
11615
|
+
const theme = this.irisGrid.getTheme();
|
|
11616
|
+
if (isFilterBarShown && theme.columnHeaderHeight != null && theme.filterBarHeight != null && isGridPointInColumnSourceFilterBox(model, gridPoint, metrics, theme)) {
|
|
11617
|
+
this.irisGrid.focusFilterBar(sourceIndex);
|
|
11618
|
+
return true;
|
|
11619
|
+
}
|
|
11620
|
+
}
|
|
11621
|
+
return false;
|
|
11622
|
+
}
|
|
11623
|
+
onClick(gridPoint, grid, event) {
|
|
11624
|
+
const { model } = this.irisGrid.props;
|
|
11625
|
+
const { isFilterBarShown, metrics } = this.irisGrid.state;
|
|
11626
|
+
const sourceIndex = getColumnSourceHeaderFromGridPoint(model, gridPoint);
|
|
11627
|
+
if (sourceIndex != null) {
|
|
11628
|
+
assertNotNull(metrics, "Metrics not set");
|
|
11629
|
+
if (!isPivotGridMetrics(metrics)) {
|
|
11630
|
+
throw new Error("PivotGridMetrics required");
|
|
11631
|
+
}
|
|
11632
|
+
const theme = this.irisGrid.getTheme();
|
|
11633
|
+
if (isFilterBarShown && theme.columnHeaderHeight != null && theme.filterBarHeight != null && isGridPointInColumnSourceFilterBox(model, gridPoint, metrics, theme)) {
|
|
11634
|
+
return true;
|
|
11635
|
+
}
|
|
11636
|
+
}
|
|
11637
|
+
return false;
|
|
11638
|
+
}
|
|
11639
|
+
}
|
|
11366
11640
|
function usePivotMouseHandlers() {
|
|
11367
11641
|
return React.useMemo(
|
|
11368
11642
|
() => [
|
|
11369
11643
|
(irisGrid2) => new PivotColumnGroupMouseHandler(irisGrid2),
|
|
11644
|
+
// Filter handler should consume events before sort
|
|
11645
|
+
(irisGrid2) => new PivotFilterMouseHandler(irisGrid2),
|
|
11370
11646
|
(irisGrid2) => new PivotSortMouseHandler(irisGrid2)
|
|
11371
11647
|
],
|
|
11372
11648
|
[]
|
|
@@ -11377,23 +11653,19 @@ function getColumnGroupName(model, modelColumn, depth) {
|
|
|
11377
11653
|
return (_a = model.getColumnHeaderGroup(modelColumn, depth ?? 0)) == null ? void 0 : _a.name;
|
|
11378
11654
|
}
|
|
11379
11655
|
class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
11656
|
+
drawColumnHeaders(context, state) {
|
|
11657
|
+
super.drawColumnHeaders(context, state);
|
|
11658
|
+
this.drawColumnSourceFilters(context, state);
|
|
11659
|
+
}
|
|
11380
11660
|
drawColumnHeadersAtDepth(context, state, range, bounds, depth) {
|
|
11381
|
-
const { metrics, model, theme } = state;
|
|
11661
|
+
const { isFilterBarShown, metrics, model, theme } = state;
|
|
11382
11662
|
if (!isIrisGridPivotModel(model)) {
|
|
11383
11663
|
throw new Error("Unsupported model type");
|
|
11384
11664
|
}
|
|
11385
|
-
const {
|
|
11386
|
-
|
|
11387
|
-
allColumnXs,
|
|
11388
|
-
gridX,
|
|
11389
|
-
userColumnWidths,
|
|
11390
|
-
allColumnWidths,
|
|
11391
|
-
movedColumns
|
|
11392
|
-
} = metrics;
|
|
11393
|
-
const { columnHeaderHeight, columnWidth } = theme;
|
|
11665
|
+
const { modelColumns } = metrics;
|
|
11666
|
+
const { columnHeaderHeight } = theme;
|
|
11394
11667
|
const { columnHeaderMaxDepth } = model;
|
|
11395
11668
|
const { minX, maxX } = bounds;
|
|
11396
|
-
const visibleWidth = maxX - minX;
|
|
11397
11669
|
if (columnHeaderMaxDepth === 0) {
|
|
11398
11670
|
return;
|
|
11399
11671
|
}
|
|
@@ -11413,71 +11685,61 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11413
11685
|
if (depth > 0) {
|
|
11414
11686
|
let columnIndex = startIndex;
|
|
11415
11687
|
while (columnIndex <= endIndex) {
|
|
11416
|
-
const { columnCount } = metrics;
|
|
11417
11688
|
const modelColumn = getOrThrow(modelColumns, columnIndex);
|
|
11418
11689
|
const columnGroupColor = model.colorForColumnHeader(
|
|
11419
11690
|
modelColumn,
|
|
11420
11691
|
depth,
|
|
11421
11692
|
theme
|
|
11422
11693
|
);
|
|
11423
|
-
const headerGroup = model.getColumnHeaderGroup(modelColumn, depth
|
|
11694
|
+
const headerGroup = model.getColumnHeaderGroup(modelColumn, depth);
|
|
11424
11695
|
const isExpandable = isPivotColumnHeaderGroup(headerGroup) && headerGroup.isExpandable;
|
|
11425
11696
|
const isExpanded = isPivotColumnHeaderGroup(headerGroup) && headerGroup.isExpanded;
|
|
11426
|
-
const
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
const
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
columnGroupRight += nextColumnWidth;
|
|
11448
|
-
nextColumnIndex += 1;
|
|
11449
|
-
}
|
|
11450
|
-
columnIndex = nextColumnIndex - 1;
|
|
11451
|
-
const isFullWidth = columnGroupRight - columnGroupLeft >= visibleWidth;
|
|
11452
|
-
let x = columnGroupLeft;
|
|
11453
|
-
if (isFullWidth) {
|
|
11454
|
-
if (columnGroupRight < maxX) {
|
|
11455
|
-
x = columnGroupRight - visibleWidth;
|
|
11456
|
-
} else if (columnGroupLeft < minX) {
|
|
11457
|
-
x = minX;
|
|
11697
|
+
const groupName = getColumnGroupName(model, modelColumn, depth);
|
|
11698
|
+
if (groupName != null && isPivotColumnHeaderGroup(headerGroup)) {
|
|
11699
|
+
const coords = getColumnHeaderCoordinates(state, headerGroup);
|
|
11700
|
+
if (coords != null) {
|
|
11701
|
+
const { x1: columnGroupLeft, x2: columnGroupRight } = coords;
|
|
11702
|
+
columnIndex = headerGroup.childIndexes[headerGroup.childIndexes.length - 1];
|
|
11703
|
+
const columnWidth = columnGroupRight - columnGroupLeft;
|
|
11704
|
+
let headerRightPadding;
|
|
11705
|
+
if (isPivotColumnHeaderGroup(headerGroup) && headerGroup.isKeyColumnGroup === true && theme.columnSourceFilterMinWidth != null) {
|
|
11706
|
+
if (isFilterBarShown) {
|
|
11707
|
+
headerRightPadding = Math.max(
|
|
11708
|
+
theme.columnSourceFilterMinWidth,
|
|
11709
|
+
columnWidth - metrics.columnSourceLabelWidth
|
|
11710
|
+
);
|
|
11711
|
+
} else {
|
|
11712
|
+
const { advancedFilters, quickFilters } = state;
|
|
11713
|
+
const { filterBarCollapsedHeight } = theme;
|
|
11714
|
+
if (advancedFilters.size > 0 || quickFilters.size > 0) {
|
|
11715
|
+
headerRightPadding = filterBarCollapsedHeight;
|
|
11716
|
+
}
|
|
11717
|
+
}
|
|
11458
11718
|
}
|
|
11719
|
+
const sort = jsapiUtils.TableUtils.getSortForColumn(model.sort, groupName);
|
|
11720
|
+
this.drawColumnHeader(
|
|
11721
|
+
context,
|
|
11722
|
+
state,
|
|
11723
|
+
model.textForColumnHeader(modelColumn, depth) ?? "",
|
|
11724
|
+
columnGroupLeft,
|
|
11725
|
+
columnWidth,
|
|
11726
|
+
{
|
|
11727
|
+
backgroundColor: columnGroupColor ?? void 0
|
|
11728
|
+
},
|
|
11729
|
+
bounds,
|
|
11730
|
+
isExpandable,
|
|
11731
|
+
isExpanded,
|
|
11732
|
+
sort,
|
|
11733
|
+
headerRightPadding
|
|
11734
|
+
);
|
|
11459
11735
|
}
|
|
11460
|
-
this.drawColumnHeader(
|
|
11461
|
-
context,
|
|
11462
|
-
state,
|
|
11463
|
-
model.textForColumnHeader(modelColumn, depth) ?? "",
|
|
11464
|
-
x,
|
|
11465
|
-
Math.min(columnGroupRight - columnGroupLeft, visibleWidth),
|
|
11466
|
-
{
|
|
11467
|
-
backgroundColor: columnGroupColor ?? void 0
|
|
11468
|
-
},
|
|
11469
|
-
bounds,
|
|
11470
|
-
isExpandable,
|
|
11471
|
-
isExpanded,
|
|
11472
|
-
jsapiUtils.TableUtils.getSortForColumn(model.sort, columnGroupName)
|
|
11473
|
-
);
|
|
11474
11736
|
}
|
|
11475
11737
|
columnIndex += 1;
|
|
11476
11738
|
}
|
|
11477
11739
|
}
|
|
11478
11740
|
context.restore();
|
|
11479
11741
|
}
|
|
11480
|
-
drawColumnHeader(context, state, columnText, columnX, columnWidth, style, bounds, isExpandable = false, isExpanded = false, sort = null) {
|
|
11742
|
+
drawColumnHeader(context, state, columnText, columnX, columnWidth, style, bounds, isExpandable = false, isExpanded = false, sort = null, headerRightPadding) {
|
|
11481
11743
|
if (columnWidth <= 0) {
|
|
11482
11744
|
return;
|
|
11483
11745
|
}
|
|
@@ -11493,7 +11755,7 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11493
11755
|
white
|
|
11494
11756
|
} = theme;
|
|
11495
11757
|
const { fontWidthsLower, fontWidthsUpper, width } = metrics;
|
|
11496
|
-
const
|
|
11758
|
+
const maxLabelWidth = columnWidth - headerHorizontalPadding * 2 - (headerRightPadding ?? 0);
|
|
11497
11759
|
const {
|
|
11498
11760
|
backgroundColor = headerBackgroundColor,
|
|
11499
11761
|
separatorColor = headerSeparatorColor
|
|
@@ -11539,7 +11801,7 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11539
11801
|
const renderText = this.textCellRenderer.getCachedTruncatedString(
|
|
11540
11802
|
context,
|
|
11541
11803
|
columnText,
|
|
11542
|
-
|
|
11804
|
+
maxLabelWidth,
|
|
11543
11805
|
fontWidthLower,
|
|
11544
11806
|
fontWidthUpper
|
|
11545
11807
|
);
|
|
@@ -11549,15 +11811,15 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11549
11811
|
maxX -= headerHorizontalPadding;
|
|
11550
11812
|
const treeMarkerPadding = isExpandable ? iconSize : 0;
|
|
11551
11813
|
const contentLeft = columnX + headerHorizontalPadding;
|
|
11552
|
-
const
|
|
11553
|
-
const contentRight = columnX + columnWidth - headerHorizontalPadding;
|
|
11554
|
-
const
|
|
11555
|
-
const
|
|
11814
|
+
const contentViewportLeft = lodash_clamp(contentLeft, minX, maxX);
|
|
11815
|
+
const contentRight = columnX + columnWidth - headerHorizontalPadding - (headerRightPadding ?? 0);
|
|
11816
|
+
const contentViewportRight = lodash_clamp(contentRight, minX, maxX);
|
|
11817
|
+
const contentViewportWidth = contentViewportRight - contentViewportLeft;
|
|
11556
11818
|
const textWidth = this.getCachedHeaderWidth(context, renderText);
|
|
11557
11819
|
const contentWidth = textWidth + treeMarkerPadding;
|
|
11558
11820
|
const isBeyondLeft = contentLeft < minX;
|
|
11559
11821
|
if (isBeyondLeft) {
|
|
11560
|
-
if (contentWidth <
|
|
11822
|
+
if (contentWidth < contentViewportWidth) {
|
|
11561
11823
|
x = minX;
|
|
11562
11824
|
} else {
|
|
11563
11825
|
x = contentRight - contentWidth;
|
|
@@ -11622,9 +11884,13 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11622
11884
|
);
|
|
11623
11885
|
}
|
|
11624
11886
|
drawColumnSourceSortIndicator(context, state, sort, columnText, columnX, columnWidth, bounds) {
|
|
11625
|
-
const { metrics, theme } = state;
|
|
11626
|
-
const { gridX, columnHeaderHeight } = metrics;
|
|
11627
|
-
const {
|
|
11887
|
+
const { isFilterBarShown, metrics, theme, quickFilters, advancedFilters } = state;
|
|
11888
|
+
const { gridX, columnHeaderHeight, columnSourceLabelWidth } = metrics;
|
|
11889
|
+
const {
|
|
11890
|
+
iconSize: themeIconSize,
|
|
11891
|
+
columnSourceFilterMinWidth,
|
|
11892
|
+
filterBarCollapsedHeight
|
|
11893
|
+
} = theme;
|
|
11628
11894
|
const iconSize = Math.round(themeIconSize * 0.75);
|
|
11629
11895
|
if (sort == null) {
|
|
11630
11896
|
return;
|
|
@@ -11633,12 +11899,15 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11633
11899
|
if (!icon) {
|
|
11634
11900
|
return;
|
|
11635
11901
|
}
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11902
|
+
if (columnSourceFilterMinWidth == null || columnSourceFilterMinWidth <= 0) {
|
|
11903
|
+
return;
|
|
11904
|
+
}
|
|
11905
|
+
const expandedFilterWidth = Math.max(
|
|
11906
|
+
columnWidth - columnSourceLabelWidth,
|
|
11907
|
+
columnSourceFilterMinWidth
|
|
11908
|
+
);
|
|
11909
|
+
const collapsedFilterWidth = advancedFilters.size > 0 || quickFilters.size > 0 ? filterBarCollapsedHeight : 0;
|
|
11910
|
+
const x = gridX + columnX + columnWidth - iconSize - (isFilterBarShown ? expandedFilterWidth : collapsedFilterWidth) - 1;
|
|
11642
11911
|
const y = (columnHeaderHeight - iconSize) * 0.5;
|
|
11643
11912
|
context.save();
|
|
11644
11913
|
context.fillStyle = theme.headerSortBarColor;
|
|
@@ -11646,6 +11915,218 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
|
|
|
11646
11915
|
context.fill(icon);
|
|
11647
11916
|
context.restore();
|
|
11648
11917
|
}
|
|
11918
|
+
drawColumnSourceFilters(context, state) {
|
|
11919
|
+
const { isFilterBarShown, quickFilters, advancedFilters } = state;
|
|
11920
|
+
if (isFilterBarShown) {
|
|
11921
|
+
this.drawExpandedColumnSourceFilters(context, state);
|
|
11922
|
+
} else if (quickFilters != null && quickFilters.size > 0 || advancedFilters != null && advancedFilters.size > 0) {
|
|
11923
|
+
this.drawCollapsedColumnSourceFilters(context, state);
|
|
11924
|
+
}
|
|
11925
|
+
}
|
|
11926
|
+
drawExpandedColumnSourceFilters(context, state) {
|
|
11927
|
+
const { model, metrics, theme, quickFilters, advancedFilters } = state;
|
|
11928
|
+
const { columnSourceFilterMinWidth } = theme;
|
|
11929
|
+
if (columnSourceFilterMinWidth == null || columnSourceFilterMinWidth <= 0) {
|
|
11930
|
+
return;
|
|
11931
|
+
}
|
|
11932
|
+
const { columnSourceLabelWidth } = metrics;
|
|
11933
|
+
const filterBoxes = getKeyColumnGroups(model).map((group) => {
|
|
11934
|
+
const coords = getColumnHeaderCoordinates(state, group);
|
|
11935
|
+
if (coords == null) {
|
|
11936
|
+
return null;
|
|
11937
|
+
}
|
|
11938
|
+
const { x1, y1, x2, y2 } = coords;
|
|
11939
|
+
const columnSourceFilterWidth = Math.max(
|
|
11940
|
+
x2 - x1 - columnSourceLabelWidth,
|
|
11941
|
+
columnSourceFilterMinWidth
|
|
11942
|
+
);
|
|
11943
|
+
return {
|
|
11944
|
+
depth: group.depth,
|
|
11945
|
+
x1: x2 - columnSourceFilterWidth,
|
|
11946
|
+
y1,
|
|
11947
|
+
x2,
|
|
11948
|
+
y2
|
|
11949
|
+
};
|
|
11950
|
+
}).filter(isNotNullOrUndefined);
|
|
11951
|
+
if (filterBoxes.length === 0) {
|
|
11952
|
+
return;
|
|
11953
|
+
}
|
|
11954
|
+
context.save();
|
|
11955
|
+
context.font = theme.filterBarFont;
|
|
11956
|
+
context.textAlign = "left";
|
|
11957
|
+
if (quickFilters != null && quickFilters.size > 0 || advancedFilters != null && advancedFilters.size > 0) {
|
|
11958
|
+
context.fillStyle = theme.filterBarExpandedActiveBackgroundColor;
|
|
11959
|
+
} else {
|
|
11960
|
+
context.fillStyle = theme.filterBarExpandedBackgroundColor;
|
|
11961
|
+
}
|
|
11962
|
+
context.fillRect(
|
|
11963
|
+
filterBoxes[0].x1,
|
|
11964
|
+
filterBoxes[filterBoxes.length - 1].y1,
|
|
11965
|
+
filterBoxes[0].x2 - filterBoxes[0].x1,
|
|
11966
|
+
filterBoxes[0].y2 - filterBoxes[filterBoxes.length - 1].y1
|
|
11967
|
+
);
|
|
11968
|
+
context.strokeStyle = theme.filterBarSeparatorColor;
|
|
11969
|
+
context.beginPath();
|
|
11970
|
+
filterBoxes.forEach(({ x1, y1, x2, y2 }) => {
|
|
11971
|
+
const w = x2 - x1;
|
|
11972
|
+
const h = y2 - y1;
|
|
11973
|
+
context.rect(x1 + 0.5, y1 + 0.5, w, h - 2);
|
|
11974
|
+
});
|
|
11975
|
+
context.stroke();
|
|
11976
|
+
filterBoxes.forEach(({ x1, x2, depth }) => {
|
|
11977
|
+
this.drawExpandedColumnSourceFilter(context, state, depth, x1, x2 - x1);
|
|
11978
|
+
});
|
|
11979
|
+
context.restore();
|
|
11980
|
+
}
|
|
11981
|
+
drawExpandedColumnSourceFilter(context, state, headerDepth, inputX, inputWidth) {
|
|
11982
|
+
if (inputWidth <= 0) {
|
|
11983
|
+
return;
|
|
11984
|
+
}
|
|
11985
|
+
const { metrics, theme, quickFilters, advancedFilters } = state;
|
|
11986
|
+
const {
|
|
11987
|
+
filterBarHeight,
|
|
11988
|
+
filterBarExpandedActiveCellBackgroundColor,
|
|
11989
|
+
filterBarErrorColor,
|
|
11990
|
+
filterBarHorizontalPadding,
|
|
11991
|
+
headerColor
|
|
11992
|
+
} = theme;
|
|
11993
|
+
const { columnHeaderHeight, gridY } = metrics;
|
|
11994
|
+
const filterIndex = -headerDepth;
|
|
11995
|
+
const quickFilter = quickFilters.get(filterIndex);
|
|
11996
|
+
const advancedFilter = advancedFilters.get(filterIndex);
|
|
11997
|
+
if (quickFilter == null && advancedFilter == null) {
|
|
11998
|
+
return;
|
|
11999
|
+
}
|
|
12000
|
+
let text = null;
|
|
12001
|
+
if (quickFilter != null) {
|
|
12002
|
+
const { text: filterText } = quickFilter;
|
|
12003
|
+
text = filterText;
|
|
12004
|
+
if (text == null || text === "") {
|
|
12005
|
+
text = jsapiUtils.TableUtils.getFilterText(quickFilter.filter);
|
|
12006
|
+
}
|
|
12007
|
+
if (text != null) {
|
|
12008
|
+
const { fontWidthsLower, fontWidthsUpper } = metrics;
|
|
12009
|
+
const fontWidthLower = fontWidthsLower.get(context.font);
|
|
12010
|
+
const fontWidthUpper = fontWidthsUpper.get(context.font);
|
|
12011
|
+
const maxLength = inputWidth - filterBarHorizontalPadding * 2;
|
|
12012
|
+
text = this.textCellRenderer.getCachedTruncatedString(
|
|
12013
|
+
context,
|
|
12014
|
+
text,
|
|
12015
|
+
maxLength,
|
|
12016
|
+
fontWidthLower,
|
|
12017
|
+
fontWidthUpper
|
|
12018
|
+
);
|
|
12019
|
+
}
|
|
12020
|
+
}
|
|
12021
|
+
const inputY = gridY - filterBarHeight - columnHeaderHeight - columnHeaderHeight * headerDepth;
|
|
12022
|
+
const isFilterValid = irisGrid.IrisGridRenderer.isFilterValid(
|
|
12023
|
+
advancedFilter,
|
|
12024
|
+
quickFilter
|
|
12025
|
+
);
|
|
12026
|
+
context.save();
|
|
12027
|
+
if (isFilterValid && filterBarExpandedActiveCellBackgroundColor != null) {
|
|
12028
|
+
context.fillStyle = filterBarExpandedActiveCellBackgroundColor;
|
|
12029
|
+
context.fillRect(
|
|
12030
|
+
inputX + 1,
|
|
12031
|
+
// +1 left border
|
|
12032
|
+
inputY + 1,
|
|
12033
|
+
// +1 top border
|
|
12034
|
+
inputWidth - 1,
|
|
12035
|
+
// -1 right border
|
|
12036
|
+
filterBarHeight - 3
|
|
12037
|
+
// -3 top, bottom border and bottom casing
|
|
12038
|
+
);
|
|
12039
|
+
} else if (filterBarErrorColor != null) {
|
|
12040
|
+
context.fillStyle = filterBarErrorColor;
|
|
12041
|
+
context.lineWidth = 2;
|
|
12042
|
+
context.strokeStyle = filterBarErrorColor;
|
|
12043
|
+
const rectLeft = inputX + 2;
|
|
12044
|
+
const rectTop = inputY + 2;
|
|
12045
|
+
const rectWidth = inputWidth - 3;
|
|
12046
|
+
const rectHeight = filterBarHeight - 5;
|
|
12047
|
+
context.strokeRect(rectLeft, rectTop, rectWidth, rectHeight);
|
|
12048
|
+
}
|
|
12049
|
+
if (text != null && text !== "") {
|
|
12050
|
+
const textX = inputX + filterBarHorizontalPadding;
|
|
12051
|
+
const textY = inputY + filterBarHeight * 0.5 + 1;
|
|
12052
|
+
context.fillStyle = headerColor;
|
|
12053
|
+
context.fillText(text, textX, textY);
|
|
12054
|
+
}
|
|
12055
|
+
context.restore();
|
|
12056
|
+
}
|
|
12057
|
+
drawCollapsedColumnSourceFilters(context, state) {
|
|
12058
|
+
const { metrics, model, theme } = state;
|
|
12059
|
+
const { gridX, gridY, columnHeaderHeight, columnHeaderMaxDepth } = metrics;
|
|
12060
|
+
const { headerSeparatorColor, filterBarCollapsedHeight } = theme;
|
|
12061
|
+
if (filterBarCollapsedHeight <= 0) {
|
|
12062
|
+
return;
|
|
12063
|
+
}
|
|
12064
|
+
const filterBoxes = getKeyColumnGroups(model).map((group) => {
|
|
12065
|
+
const coords = getColumnHeaderCoordinates(state, group);
|
|
12066
|
+
if (coords == null) {
|
|
12067
|
+
return null;
|
|
12068
|
+
}
|
|
12069
|
+
const { x2: x22, y1, y2 } = coords;
|
|
12070
|
+
return {
|
|
12071
|
+
depth: group.depth,
|
|
12072
|
+
x1: x22 - filterBarCollapsedHeight,
|
|
12073
|
+
y1,
|
|
12074
|
+
x2: x22,
|
|
12075
|
+
y2
|
|
12076
|
+
};
|
|
12077
|
+
}).filter(isNotNullOrUndefined);
|
|
12078
|
+
if (filterBoxes.length === 0) {
|
|
12079
|
+
return;
|
|
12080
|
+
}
|
|
12081
|
+
context.save();
|
|
12082
|
+
const { x2 } = filterBoxes[filterBoxes.length - 1];
|
|
12083
|
+
context.fillStyle = headerSeparatorColor;
|
|
12084
|
+
context.fillRect(
|
|
12085
|
+
gridX + x2 - filterBarCollapsedHeight,
|
|
12086
|
+
gridY - columnHeaderHeight * columnHeaderMaxDepth - filterBarCollapsedHeight,
|
|
12087
|
+
filterBarCollapsedHeight,
|
|
12088
|
+
columnHeaderHeight * (columnHeaderMaxDepth - 1)
|
|
12089
|
+
);
|
|
12090
|
+
filterBoxes.forEach(({ x2: columnRight, depth }) => {
|
|
12091
|
+
this.drawCollapsedColumnSourceFilter(context, state, depth, columnRight);
|
|
12092
|
+
});
|
|
12093
|
+
context.restore();
|
|
12094
|
+
}
|
|
12095
|
+
// eslint-disable-next-line class-methods-use-this
|
|
12096
|
+
drawCollapsedColumnSourceFilter(context, state, headerDepth, columnRight) {
|
|
12097
|
+
if (columnRight <= 0) {
|
|
12098
|
+
return;
|
|
12099
|
+
}
|
|
12100
|
+
const { metrics, theme, quickFilters, advancedFilters } = state;
|
|
12101
|
+
const { columnHeaderHeight, gridY } = metrics;
|
|
12102
|
+
const filterIndex = -headerDepth;
|
|
12103
|
+
const quickFilter = quickFilters.get(filterIndex);
|
|
12104
|
+
const advancedFilter = advancedFilters.get(filterIndex);
|
|
12105
|
+
const {
|
|
12106
|
+
filterBarCollapsedHeight,
|
|
12107
|
+
filterBarActiveColor,
|
|
12108
|
+
filterBarActiveBackgroundColor,
|
|
12109
|
+
filterBarErrorColor
|
|
12110
|
+
} = theme;
|
|
12111
|
+
context.save();
|
|
12112
|
+
const isFilterValid = irisGrid.IrisGridRenderer.isFilterValid(
|
|
12113
|
+
advancedFilter,
|
|
12114
|
+
quickFilter
|
|
12115
|
+
);
|
|
12116
|
+
if (filterBarActiveBackgroundColor != null && quickFilter == null && advancedFilter == null) {
|
|
12117
|
+
context.fillStyle = filterBarActiveBackgroundColor;
|
|
12118
|
+
} else if (filterBarActiveColor != null && isFilterValid) {
|
|
12119
|
+
context.fillStyle = filterBarActiveColor;
|
|
12120
|
+
} else if (filterBarErrorColor != null) {
|
|
12121
|
+
context.fillStyle = filterBarErrorColor;
|
|
12122
|
+
}
|
|
12123
|
+
const x = columnRight - filterBarCollapsedHeight + 1;
|
|
12124
|
+
const y = gridY - filterBarCollapsedHeight - columnHeaderHeight - columnHeaderHeight * headerDepth;
|
|
12125
|
+
const rectWidth = filterBarCollapsedHeight - 1;
|
|
12126
|
+
const rectHeight = columnHeaderHeight - 1;
|
|
12127
|
+
context.fillRect(x, y, rectWidth, rectHeight);
|
|
12128
|
+
context.restore();
|
|
12129
|
+
}
|
|
11649
12130
|
}
|
|
11650
12131
|
function usePivotRenderer() {
|
|
11651
12132
|
return React.useMemo(() => new IrisGridPivotRenderer(), []);
|
|
@@ -11656,7 +12137,8 @@ const IrisGridPivotThemeColors = Object.freeze({
|
|
|
11656
12137
|
});
|
|
11657
12138
|
function getIrisGridPivotTheme() {
|
|
11658
12139
|
return Object.freeze({
|
|
11659
|
-
...components.resolveCssVariablesInRecord(IrisGridPivotThemeColors)
|
|
12140
|
+
...components.resolveCssVariablesInRecord(IrisGridPivotThemeColors),
|
|
12141
|
+
columnSourceFilterMinWidth: 120
|
|
11660
12142
|
});
|
|
11661
12143
|
}
|
|
11662
12144
|
const log$1 = Log.module("@deephaven/js-plugin-pivot/usePivotTheme");
|
|
@@ -11667,6 +12149,12 @@ function usePivotTheme() {
|
|
|
11667
12149
|
return getIrisGridPivotTheme();
|
|
11668
12150
|
}, [theme]);
|
|
11669
12151
|
}
|
|
12152
|
+
function usePivotMetricCalculatorFactory() {
|
|
12153
|
+
return React.useMemo(
|
|
12154
|
+
() => (...args) => new IrisGridPivotMetricCalculator(...args),
|
|
12155
|
+
[]
|
|
12156
|
+
);
|
|
12157
|
+
}
|
|
11670
12158
|
function PivotWidget({
|
|
11671
12159
|
fetch
|
|
11672
12160
|
}) {
|
|
@@ -11674,6 +12162,7 @@ function PivotWidget({
|
|
|
11674
12162
|
const mouseHandlers = usePivotMouseHandlers();
|
|
11675
12163
|
const renderer = usePivotRenderer();
|
|
11676
12164
|
const pivotTheme = usePivotTheme();
|
|
12165
|
+
const getPivotMetricCalculator = usePivotMetricCalculatorFactory();
|
|
11677
12166
|
const fetchResult = useIrisGridPivotModel(pivotFetch);
|
|
11678
12167
|
if (fetchResult.status === "loading") {
|
|
11679
12168
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(components.LoadingOverlay, { isLoading: true });
|
|
@@ -11694,7 +12183,8 @@ function PivotWidget({
|
|
|
11694
12183
|
model,
|
|
11695
12184
|
mouseHandlers,
|
|
11696
12185
|
renderer,
|
|
11697
|
-
theme: pivotTheme
|
|
12186
|
+
theme: pivotTheme,
|
|
12187
|
+
getMetricCalculator: getPivotMetricCalculator
|
|
11698
12188
|
}
|
|
11699
12189
|
);
|
|
11700
12190
|
}
|
|
@@ -11707,6 +12197,7 @@ function useHydratePivotGrid(id, metadata) {
|
|
|
11707
12197
|
const mouseHandlers = usePivotMouseHandlers();
|
|
11708
12198
|
const renderer = usePivotRenderer();
|
|
11709
12199
|
const theme = usePivotTheme();
|
|
12200
|
+
const getMetricCalculator = usePivotMetricCalculatorFactory();
|
|
11710
12201
|
const { status } = objectFetch;
|
|
11711
12202
|
if (status === "loading") {
|
|
11712
12203
|
log.debug("Widget is loading");
|
|
@@ -11739,7 +12230,8 @@ function useHydratePivotGrid(id, metadata) {
|
|
|
11739
12230
|
metadata,
|
|
11740
12231
|
mouseHandlers,
|
|
11741
12232
|
renderer,
|
|
11742
|
-
theme
|
|
12233
|
+
theme,
|
|
12234
|
+
getMetricCalculator
|
|
11743
12235
|
}
|
|
11744
12236
|
};
|
|
11745
12237
|
}
|