@deephaven/js-plugin-pivot 0.0.3-alpha-pivots.988 → 0.0.3-dev.984

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +28 -53
  2. package/package.json +6 -11
package/dist/index.js CHANGED
@@ -9920,10 +9920,10 @@ _defineProperty(GridRenderer, "getCachedColorWithAlpha", memoizeClear$1(GridColo
9920
9920
  _defineProperty(GridRenderer, "getCachedColorIsDark", memoizeClear$1(ColorUtils$1.isDark, {
9921
9921
  max: 1e3
9922
9922
  }));
9923
- function isPivotColumnHeaderGroup(group) {
9924
- return group instanceof PivotColumnHeaderGroup;
9923
+ function isExpandableColumnHeaderGroup(group) {
9924
+ return group instanceof ExpandableColumnHeaderGroup;
9925
9925
  }
9926
- class PivotColumnHeaderGroup extends irisGrid.ColumnHeaderGroup {
9926
+ class ExpandableColumnHeaderGroup extends irisGrid.ColumnHeaderGroup {
9927
9927
  constructor({
9928
9928
  name,
9929
9929
  displayName,
@@ -10022,10 +10022,10 @@ function makeGrandTotalColumnName(valueSource) {
10022
10022
  return `__GRAND_TOTAL/${valueSource.name}`;
10023
10023
  }
10024
10024
  function makeColumnName(keys2, depth) {
10025
- return keys2.slice(0, depth + 1).filter((k) => k != null).map((k) => encodeURIComponent(String(k))).join("/");
10025
+ return keys2.slice(0, depth + 1).filter((k) => k != null).join("/");
10026
10026
  }
10027
10027
  function makeColumnGroupName(keys2, columnSources, depth) {
10028
- return keys2.slice(0, depth + 1).map((k, i) => k == null ? columnSources[i].name : k).map((k) => encodeURIComponent(String(k))).join("/");
10028
+ return keys2.slice(0, depth + 1).map((k, i) => k == null ? columnSources[i].name : k).join("/");
10029
10029
  }
10030
10030
  function makeValueSourceColumnName(columnName, valueSource) {
10031
10031
  return `${columnName}/${valueSource.name}`;
@@ -10072,11 +10072,11 @@ function checkColumnsChanged(prevColumns, newColumns) {
10072
10072
  }
10073
10073
  function getKeyColumnGroups(columnSources, rowSources) {
10074
10074
  const groups = columnSources.length === 0 ? [
10075
- new PivotColumnHeaderGroup({
10076
- name: "/",
10075
+ new ExpandableColumnHeaderGroup({
10076
+ // TODO:
10077
+ name: "__All",
10077
10078
  displayName: "",
10078
- // For empty row sources we will render a "dead column"
10079
- // or a Groups column, depending on the table settings
10079
+ // TODO: what if rowSources is empty?
10080
10080
  children: rowSources.map((c) => c.name),
10081
10081
  childIndexes: [],
10082
10082
  isKeyColumnGroup: true,
@@ -10084,7 +10084,7 @@ function getKeyColumnGroups(columnSources, rowSources) {
10084
10084
  isExpandable: false
10085
10085
  })
10086
10086
  ] : columnSources.map(
10087
- (source, i) => new PivotColumnHeaderGroup({
10087
+ (source, i) => new ExpandableColumnHeaderGroup({
10088
10088
  name: source.name,
10089
10089
  displayName: source.name,
10090
10090
  children: i === columnSources.length - 1 ? rowSources.map((c) => c.name) : [columnSources[i + 1].name],
@@ -10102,15 +10102,20 @@ function getKeyColumnGroups(columnSources, rowSources) {
10102
10102
  function getTotalsColumnGroups(columnSources, valueSources, isRootColumnExpanded) {
10103
10103
  const groupName = pluralize(valueSources.length, GRAND_TOTALS_GROUP_NAME);
10104
10104
  return columnSources.length === 0 ? [
10105
- new PivotColumnHeaderGroup({
10106
- name: "/GrandTotals",
10105
+ new ExpandableColumnHeaderGroup({
10106
+ // TODO:
10107
+ name: "TMP__GrandTotals",
10107
10108
  displayName: groupName,
10108
10109
  children: valueSources.map((v) => makeGrandTotalColumnName(v)),
10109
10110
  childIndexes: [],
10110
10111
  depth: 1
10112
+ // Only the top level is expandable
10113
+ // TODO:
10114
+ // isExpandable: i === 0,
10115
+ // isExpanded: isRootColumnExpanded,
10111
10116
  })
10112
10117
  ] : columnSources.map(
10113
- (source, i) => new PivotColumnHeaderGroup({
10118
+ (source, i) => new ExpandableColumnHeaderGroup({
10114
10119
  name: makeGrandTotalColumnName(source),
10115
10120
  displayName: i === 0 ? groupName : "",
10116
10121
  children: i === columnSources.length - 1 ? valueSources.map((v) => makeGrandTotalColumnName(v)) : [makeGrandTotalColumnName(columnSources[i + 1])],
@@ -10136,7 +10141,7 @@ function getSnapshotColumnGroups(snapshotColumns, columnSources, valueSources, f
10136
10141
  const isTotalGroup = keys2[i] == null;
10137
10142
  const parentKey = i > 0 ? keys2[i - 1] : null;
10138
10143
  const totalsGroupDisplayName = parentKey == null ? "" : groupName;
10139
- const group = groupMap.get(name) ?? new PivotColumnHeaderGroup({
10144
+ const group = groupMap.get(name) ?? new ExpandableColumnHeaderGroup({
10140
10145
  name,
10141
10146
  displayName: isTotalGroup ? totalsGroupDisplayName : keys2[i],
10142
10147
  isTotalGroup,
@@ -10184,9 +10189,6 @@ const SET_VIEWPORT_THROTTLE = 150;
10184
10189
  const APPLY_VIEWPORT_THROTTLE = 0;
10185
10190
  const ROW_BUFFER_PAGES = 1;
10186
10191
  const COLUMN_BUFFER_PAGES = 1;
10187
- function isIrisGridPivotModel(model) {
10188
- return typeof model === "object" && model !== null && "pivotTable" in model && "keyColumns" in model && "expandAll" in model && "collapseAll" in model && "hasExpandableRows" in model && "hasExpandableColumns" in model;
10189
- }
10190
10192
  class IrisGridPivotModel extends irisGrid.IrisGridModel {
10191
10193
  constructor(dh, pivotTable, formatter = new jsapiUtils.Formatter(dh), config = {}) {
10192
10194
  if (!isCorePlusDh(dh)) {
@@ -10552,7 +10554,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
10552
10554
  } = irisGrid.IrisGridUtils.parseColumnHeaderGroups(
10553
10555
  this,
10554
10556
  groups,
10555
- (args) => new PivotColumnHeaderGroup(args)
10557
+ (args) => new ExpandableColumnHeaderGroup(args)
10556
10558
  );
10557
10559
  this._columnHeaderGroups = newGroups;
10558
10560
  this.columnHeaderMaxDepth = maxDepth;
@@ -10567,14 +10569,14 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
10567
10569
  }
10568
10570
  textForColumnHeader(x, depth = 0) {
10569
10571
  const header = this.columnAtDepth(x, depth);
10570
- if (isPivotColumnHeaderGroup(header)) {
10572
+ if (isExpandableColumnHeaderGroup(header)) {
10571
10573
  return header.isNew ? "" : header.displayName ?? header.name;
10572
10574
  }
10573
10575
  return (header == null ? void 0 : header.displayName) ?? (header == null ? void 0 : header.name);
10574
10576
  }
10575
10577
  colorForColumnHeader(x, depth = 0, theme = {}) {
10576
10578
  const column = this.columnAtDepth(x, depth);
10577
- if (isPivotColumnHeaderGroup(column)) {
10579
+ if (isExpandableColumnHeaderGroup(column)) {
10578
10580
  if (column.isTotalGroup != null && column.isTotalGroup) {
10579
10581
  return theme.totalsHeaderBackground ?? null;
10580
10582
  }
@@ -10586,7 +10588,7 @@ class IrisGridPivotModel extends irisGrid.IrisGridModel {
10586
10588
  }
10587
10589
  getColumnHeaderGroup(modelIndex, depth) {
10588
10590
  const group = this.columnAtDepth(modelIndex, depth);
10589
- if (isPivotColumnHeaderGroup(group)) {
10591
+ if (isExpandableColumnHeaderGroup(group)) {
10590
10592
  return group;
10591
10593
  }
10592
10594
  return void 0;
@@ -11231,26 +11233,6 @@ class PivotColumnGroupMouseHandler extends GridMouseHandler {
11231
11233
  }
11232
11234
  return null;
11233
11235
  }
11234
- setCursor(gridPoint, grid) {
11235
- const { column, columnHeaderDepth } = gridPoint;
11236
- if (this.isExpandableColumnGroup(column, columnHeaderDepth)) {
11237
- this.cursor = "pointer";
11238
- return { stopPropagation: false, preventDefault: false };
11239
- }
11240
- this.cursor = null;
11241
- return false;
11242
- }
11243
- isExpandableColumnGroup(column, columnHeaderDepth = 0) {
11244
- const { model } = this.irisGrid.props;
11245
- if (column == null || model == null) {
11246
- return false;
11247
- }
11248
- const group = model.getColumnHeaderGroup(column, columnHeaderDepth);
11249
- return group != null && isPivotColumnHeaderGroup(group) && group.isExpandable;
11250
- }
11251
- onMove(gridPoint, grid) {
11252
- return this.setCursor(gridPoint, grid);
11253
- }
11254
11236
  // We need to remember where the down started, because the canvas element will trigger a click wherever mouseUp is
11255
11237
  onDown(gridPoint) {
11256
11238
  this.column = this.getColumnGroupFromGridPoint(gridPoint);
@@ -11258,7 +11240,7 @@ class PivotColumnGroupMouseHandler extends GridMouseHandler {
11258
11240
  }
11259
11241
  onClick(gridPoint, grid, event) {
11260
11242
  const column = this.getColumnGroupFromGridPoint(gridPoint);
11261
- if (column != null && column === this.column && this.isExpandableColumnGroup(column, gridPoint.columnHeaderDepth)) {
11243
+ if (column != null && column === this.column) {
11262
11244
  this.irisGrid.toggleExpandColumn(column);
11263
11245
  return true;
11264
11246
  }
@@ -11417,9 +11399,6 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
11417
11399
  }
11418
11400
  drawColumnHeadersAtDepth(context, state, range, bounds, depth) {
11419
11401
  const { metrics, model, theme } = state;
11420
- if (!isIrisGridPivotModel(model)) {
11421
- throw new Error("Unsupported model type");
11422
- }
11423
11402
  const {
11424
11403
  modelColumns,
11425
11404
  allColumnXs,
@@ -11453,14 +11432,10 @@ class IrisGridPivotRenderer extends irisGrid.IrisGridRenderer {
11453
11432
  while (columnIndex <= endIndex) {
11454
11433
  const { columnCount } = metrics;
11455
11434
  const modelColumn = getOrThrow(modelColumns, columnIndex);
11456
- const columnGroupColor = model.colorForColumnHeader(
11457
- modelColumn,
11458
- depth,
11459
- theme
11460
- );
11435
+ const columnGroupColor = isExpandableColumnGridModel(model) ? model.colorForColumnHeader(modelColumn, depth, theme) : model.colorForColumnHeader(modelColumn, depth);
11461
11436
  const headerGroup = model.getColumnHeaderGroup(modelColumn, depth ?? 0);
11462
- const isExpandable = isPivotColumnHeaderGroup(headerGroup) && headerGroup.isExpandable;
11463
- const isExpanded = isPivotColumnHeaderGroup(headerGroup) && headerGroup.isExpanded;
11437
+ const isExpandable = isExpandableColumnHeaderGroup(headerGroup) && headerGroup.isExpandable;
11438
+ const isExpanded = isExpandableColumnHeaderGroup(headerGroup) && headerGroup.isExpanded;
11464
11439
  const columnGroupName = getColumnGroupName(model, modelColumn, depth);
11465
11440
  let columnGroupLeft = getOrThrow(allColumnXs, columnIndex) + gridX;
11466
11441
  let columnGroupRight = columnGroupLeft + getOrThrow(allColumnWidths, columnIndex);
@@ -11711,7 +11686,7 @@ function useHydratePivotGrid(fetch, id, metadata) {
11711
11686
  const loadPlugin = dashboardCorePlugins.useLoadTablePlugin();
11712
11687
  const fetchTable = React.useCallback(
11713
11688
  () => fetch().then((result) => {
11714
- log$1.debug("Pivot fetch result:", result);
11689
+ log$1.debug("pivotWidget fetch result:", result);
11715
11690
  if (!isCorePlusDh(api)) {
11716
11691
  throw new Error("CorePlus is not available");
11717
11692
  }
package/package.json CHANGED
@@ -1,20 +1,14 @@
1
1
  {
2
2
  "name": "@deephaven/js-plugin-pivot",
3
- "version": "0.0.3-alpha-pivots.988+5b061b1",
3
+ "version": "0.0.3-dev.984+0d63a3d6",
4
4
  "description": "Pivot plugin for Deephaven",
5
5
  "keywords": [
6
6
  "Deephaven",
7
- "plugin",
8
- "deephaven-js-plugin",
9
- "pivot"
7
+ "plugin"
10
8
  ],
11
- "author": "Deephaven Data Labs LLC",
9
+ "author": "Deephaven Data Labs",
12
10
  "license": "Apache-2.0",
13
11
  "main": "dist/index.js",
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/deephaven/deephaven-plugins"
17
- },
18
12
  "scripts": {
19
13
  "start": "vite build --watch",
20
14
  "build": "vite build"
@@ -54,10 +48,11 @@
54
48
  "nanoid": "^5.1.5"
55
49
  },
56
50
  "publishConfig": {
57
- "access": "public"
51
+ "access": "public",
52
+ "provenance": false
58
53
  },
59
54
  "files": [
60
55
  "dist/index.js"
61
56
  ],
62
- "gitHead": "5b061b1eec07f0532fa8c4bb47b38587cae7109d"
57
+ "gitHead": "0d63a3d64a19349448965fc689a3b0e4511fb7b2"
63
58
  }