@deephaven/grid 0.106.1 → 0.106.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MockTreeGridModel.d.ts","sourceRoot":"","sources":["../src/MockTreeGridModel.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,KAAK,eAAe,GAAG,GAAG,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE1D;;;GAGG;AACH,cAAM,iBAAkB,SAAQ,aAAc,YAAW,mBAAmB;IAC1E,MAAM,CAAC,iBAAiB,SAAc;IAEtC,MAAM,CAAC,oBAAoB,SAAO;IAElC,sHAAsH;IACtH,MAAM,CAAC,8BAA8B,SAAQ;IAE7C,MAAM,CAAC,mBAAmB,SAAM;IAEhC,MAAM,CAAC,SAAS,SAAM;IAEtB,OAAO,CAAC,QAAQ,CAAkB;IAElC,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,QAAQ,CAAS;gBAEb,EACV,QAA8C,EAC9C,WAAoD,EACpD,QAAoB,EACpB,aAKC,EACD,QAAsC,GACvC,GAAE;QACD,QAAQ,CAAC,EAAE,eAAe,CAAC;QAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACd;IAQN,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,MAAM;IAIxD,gBAAgB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM;IAIzC,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO;IAItC,IAAI,iBAAiB,IAAI,O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AG,OAAO;IAIvC,cAAc,CACZ,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,OAAO,EACnB,iBAAiB,UAAQ,GACxB,IAAI;IA8BP,SAAS,IAAI,IAAI;IAIjB,WAAW,IAAI,IAAI;IAInB,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM;IAIpC;;;;OAIG;IACH,uBAAuB,cAET,eAAe,OACpB,UAAU,KACd;QAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,UAAU,CAAA;KAAE,kDAFxC,eAAe,OACpB,UAAU,KACd;QAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,UAAU,CAAA;KAAE,EAsBpD;IAEF,yBAAyB,cACZ,eAAe,OAAO,UAAU,KAAG,MAAM,kDAAzC,eAAe,OAAO,UAAU,KAAG,MAAM,EAapD;IAEF,oBAAoB,cAEN,eAAe,UACjB,UAAU,OACb,UAAU,KACd,MAAM,kDAHG,eAAe,UACjB,UAAU,OACb,UAAU,KACd,MAAM,EAaT;IAEF,wBAAwB,cACX,eAAe,OAAO,UAAU,YAAY,MAAM,KAAG,OAAO,kDAA5D,eAAe,OAAO,UAAU,YAAY,MAAM,KAAG,OAAO,EAMvE;IAEF,sBAAsB,cACT,eAAe,OAAO,UAAU,KAAG,OAAO,kDAA1C,eAAe,OAAO,UAAU,KAAG,OAAO,EAarD;IAEF,oBAAoB,cACP,eAAe,OAAO,UAAU,KAAG,MAAM,kDAAzC,eAAe,OAAO,UAAU,KAAG,MAAM,EAapD;CACH;AAED,eAAe,iBAAiB,CAAC"}
@@ -49,6 +49,8 @@ class MockTreeGridModel extends MockGridModel {
49
49
  key,
50
50
  offsetRow
51
51
  };
52
+ }, {
53
+ max: 10000
52
54
  }));
53
55
  _defineProperty(this, "getCachedTextForRowHeader", memoizeClear((children, row) => {
54
56
  var {
@@ -62,6 +64,8 @@ class MockTreeGridModel extends MockGridModel {
62
64
  }
63
65
  }
64
66
  return "".concat(offsetRow);
67
+ }, {
68
+ max: 10000
65
69
  }));
66
70
  _defineProperty(this, "getCachedTextForCell", memoizeClear((children, column, row) => {
67
71
  var {
@@ -75,10 +79,14 @@ class MockTreeGridModel extends MockGridModel {
75
79
  }
76
80
  }
77
81
  return "".concat(column, ",").concat(offsetRow);
82
+ }, {
83
+ max: 10000
78
84
  }));
79
85
  _defineProperty(this, "getCachedIsRowExpandable", memoizeClear((children, row, maxDepth) => {
80
86
  var depth = this.getCachedDepthForRow(children, row);
81
87
  return depth < maxDepth;
88
+ }, {
89
+ max: 10000
82
90
  }));
83
91
  _defineProperty(this, "getCachedIsRowExpanded", memoizeClear((children, row) => {
84
92
  var {
@@ -92,6 +100,8 @@ class MockTreeGridModel extends MockGridModel {
92
100
  }
93
101
  }
94
102
  return children.has(offsetRow);
103
+ }, {
104
+ max: 10000
95
105
  }));
96
106
  _defineProperty(this, "getCachedDepthForRow", memoizeClear((children, row) => {
97
107
  var {
@@ -105,6 +115,8 @@ class MockTreeGridModel extends MockGridModel {
105
115
  }
106
116
  }
107
117
  return 0;
118
+ }, {
119
+ max: 10000
108
120
  }));
109
121
  this.children = _children;
110
122
  this.childRowCount = _childRowCount;
@@ -1 +1 @@
1
- {"version":3,"file":"MockTreeGridModel.js","names":["MockGridModel","memoizeClear","MockTreeGridModel","constructor","rowCount","DEFAULT_ROW_COUNT","columnCount","DEFAULT_COLUMN_COUNT","children","Map","childRowCount","Math","ceil","max","MIN_CHILD_ROW_COUNT","DEFAULT_CHILD_ROW_COUNT_FACTOR","maxDepth","MAX_DEPTH","arguments","length","undefined","_defineProperty","row","key","offsetRow","sortedEntries","sort","a","b","i","childRow","childModel","getCachedModelRowOffset","model","get","concat","textForRowHeader","column","textForCell","depth","getCachedDepthForRow","isRowExpanded","has","depthForRow","getCachedTextForCell","getCachedTextForRowHeader","isRowMovable","hasExpandableRows","isExpandAllAvailable","floatingBottomRowCount","isRowExpandable","getCachedIsRowExpandable","getCachedIsRowExpanded","setRowExpanded","isExpanded","expandDescendants","originalChildRowCount","numRows","delete","child","numColumns","set","expandAll","Error","collapseAll"],"sources":["../src/MockTreeGridModel.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\nimport MockGridModel from './MockGridModel';\nimport memoizeClear from './memoizeClear';\nimport type ExpandableGridModel from './ExpandableGridModel';\nimport { type ModelIndex } from './GridMetrics';\n\ntype ChildrenTreeMap = Map<ModelIndex, MockTreeGridModel>;\n\n/**\n * A class to mock a tree model so can test out tree models.\n * Whenever a row is expanded, it creates a child model for that row, which can then make a child for those rows, etc.\n */\nclass MockTreeGridModel extends MockGridModel implements ExpandableGridModel {\n static DEFAULT_ROW_COUNT = 1000000000;\n\n static DEFAULT_COLUMN_COUNT = 100;\n\n /** How many rows a child tree should have related to the parent. Eg. if parent has 10000 rows, child will have 100 */\n static DEFAULT_CHILD_ROW_COUNT_FACTOR = 0.01;\n\n static MIN_CHILD_ROW_COUNT = 10;\n\n static MAX_DEPTH = 10;\n\n private children: ChildrenTreeMap;\n\n private childRowCount: number;\n\n private maxDepth: number;\n\n constructor({\n rowCount = MockTreeGridModel.DEFAULT_ROW_COUNT,\n columnCount = MockTreeGridModel.DEFAULT_COLUMN_COUNT,\n children = new Map(),\n childRowCount = Math.ceil(\n Math.max(\n MockTreeGridModel.MIN_CHILD_ROW_COUNT,\n rowCount * MockTreeGridModel.DEFAULT_CHILD_ROW_COUNT_FACTOR\n )\n ),\n maxDepth = MockTreeGridModel.MAX_DEPTH,\n }: {\n children?: ChildrenTreeMap;\n columnCount?: number;\n rowCount?: number;\n childRowCount?: number;\n maxDepth?: number;\n } = {}) {\n super({ rowCount, columnCount });\n\n this.children = children;\n this.childRowCount = childRowCount;\n this.maxDepth = maxDepth;\n }\n\n textForCell(column: ModelIndex, row: ModelIndex): string {\n return this.getCachedTextForCell(this.children, column, row);\n }\n\n textForRowHeader(row: ModelIndex): string {\n return this.getCachedTextForRowHeader(this.children, row);\n }\n\n isRowMovable(row: ModelIndex): boolean {\n return false;\n }\n\n get hasExpandableRows(): boolean {\n return true;\n }\n\n get isExpandAllAvailable(): boolean {\n return false;\n }\n\n get floatingBottomRowCount(): number {\n return 0;\n }\n\n isRowExpandable(row: ModelIndex): boolean {\n return this.getCachedIsRowExpandable(this.children, row, this.maxDepth);\n }\n\n isRowExpanded(row: ModelIndex): boolean {\n return this.getCachedIsRowExpanded(this.children, row);\n }\n\n setRowExpanded(\n row: ModelIndex,\n isExpanded: boolean,\n expandDescendants = false\n ): void {\n const { key, offsetRow } = this.getCachedModelRowOffset(this.children, row);\n\n // We always set a new map so that our memoize functions work properly\n const children = new Map(this.children);\n if (key != null) {\n const model = this.children.get(key);\n if (model !== undefined) {\n const { rowCount: originalChildRowCount } = model;\n model.setRowExpanded(offsetRow, isExpanded, expandDescendants);\n this.numRows += model.rowCount - originalChildRowCount;\n }\n } else if (!isExpanded) {\n const childModel = children.get(offsetRow);\n if (childModel !== undefined) {\n this.numRows -= childModel.rowCount;\n children.delete(offsetRow);\n }\n } else {\n const child = new MockTreeGridModel({\n rowCount: this.childRowCount,\n columnCount: this.numColumns,\n });\n children.set(offsetRow, child);\n this.numRows += child.rowCount;\n }\n\n this.children = children;\n }\n\n expandAll(): void {\n throw new Error('Expand all not implemented.');\n }\n\n collapseAll(): void {\n throw new Error('Collapse all not implemented.');\n }\n\n depthForRow(row: ModelIndex): number {\n return this.getCachedDepthForRow(this.children, row);\n }\n\n /**\n * Returns the map key and the offsetRow given the provided children and row index.\n * If the returned key is null, then this offset row is within this model.\n * Only returning the key instead of the model so that memoize doesn't cache a bunch of the children models after they've been deleted (collapsed).\n */\n getCachedModelRowOffset = memoizeClear(\n (\n children: ChildrenTreeMap,\n row: ModelIndex\n ): { key: ModelIndex | null; offsetRow: ModelIndex } => {\n let key = null;\n let offsetRow = row;\n // Need to iterate through the map in order... sort it first\n const sortedEntries = [...children].sort((a, b) => a[0] - b[0]);\n for (let i = 0; i < sortedEntries.length; i += 1) {\n const [childRow, childModel] = sortedEntries[i];\n if (offsetRow <= childRow) {\n break;\n }\n const childRowCount = childModel.rowCount;\n if (offsetRow <= childRow + childRowCount) {\n key = childRow;\n offsetRow = offsetRow - childRow - 1;\n break;\n }\n offsetRow -= childRowCount;\n }\n\n return { key, offsetRow };\n }\n );\n\n getCachedTextForRowHeader = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex): string => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return `${key}.${model.textForRowHeader(offsetRow)}`;\n }\n }\n\n return `${offsetRow}`;\n }\n );\n\n getCachedTextForCell = memoizeClear(\n (\n children: ChildrenTreeMap,\n column: ModelIndex,\n row: ModelIndex\n ): string => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return `${key}.${model.textForCell(column, offsetRow)}`;\n }\n }\n\n return `${column},${offsetRow}`;\n }\n );\n\n getCachedIsRowExpandable = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex, maxDepth: number): boolean => {\n const depth = this.getCachedDepthForRow(children, row);\n\n return depth < maxDepth;\n }\n );\n\n getCachedIsRowExpanded = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex): boolean => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return model.isRowExpanded(offsetRow);\n }\n }\n\n return children.has(offsetRow);\n }\n );\n\n getCachedDepthForRow = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex): number => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return model.depthForRow(offsetRow) + 1;\n }\n }\n\n return 0;\n }\n );\n}\n\nexport default MockTreeGridModel;\n"],"mappings":";;;AAAA;AACA;AAAA,OACOA,aAAa;AAAA,OACbC,YAAY;A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AAiB,0BAGS,GAAG;AAAAmB,eAAA,CAH7BnB,iBAAiB,oCAMmB,IAAI;AAAAmB,eAAA,CANxCnB,iBAAiB,yBAQQ,EAAE;AAAAmB,eAAA,CAR3BnB,iBAAiB,eAUF,EAAE;AAwNvB,eAAeA,iBAAiB"}
1
+ {"version":3,"file":"MockTreeGridModel.js","names":["MockGridModel","memoizeClear","MockTreeGridModel","constructor","rowCount","DEFAULT_ROW_COUNT","columnCount","DEFAULT_COLUMN_COUNT","children","Map","childRowCount","Math","ceil","max","MIN_CHILD_ROW_COUNT","DEFAULT_CHILD_ROW_COUNT_FACTOR","maxDepth","MAX_DEPTH","arguments","length","undefined","_defineProperty","row","key","offsetRow","sortedEntries","sort","a","b","i","childRow","childModel","getCachedModelRowOffset","model","get","concat","textForRowHeader","column","textForCell","depth","getCachedDepthForRow","isRowExpanded","has","depthForRow","getCachedTextForCell","getCachedTextForRowHeader","isRowMovable","hasExpandableRows","isExpandAllAvailable","floatingBottomRowCount","isRowExpandable","getCachedIsRowExpandable","getCachedIsRowExpanded","setRowExpanded","isExpanded","expandDescendants","originalChildRowCount","numRows","delete","child","numColumns","set","expandAll","Error","collapseAll"],"sources":["../src/MockTreeGridModel.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\nimport MockGridModel from './MockGridModel';\nimport memoizeClear from './memoizeClear';\nimport type ExpandableGridModel from './ExpandableGridModel';\nimport { type ModelIndex } from './GridMetrics';\n\ntype ChildrenTreeMap = Map<ModelIndex, MockTreeGridModel>;\n\n/**\n * A class to mock a tree model so can test out tree models.\n * Whenever a row is expanded, it creates a child model for that row, which can then make a child for those rows, etc.\n */\nclass MockTreeGridModel extends MockGridModel implements ExpandableGridModel {\n static DEFAULT_ROW_COUNT = 1000000000;\n\n static DEFAULT_COLUMN_COUNT = 100;\n\n /** How many rows a child tree should have related to the parent. Eg. if parent has 10000 rows, child will have 100 */\n static DEFAULT_CHILD_ROW_COUNT_FACTOR = 0.01;\n\n static MIN_CHILD_ROW_COUNT = 10;\n\n static MAX_DEPTH = 10;\n\n private children: ChildrenTreeMap;\n\n private childRowCount: number;\n\n private maxDepth: number;\n\n constructor({\n rowCount = MockTreeGridModel.DEFAULT_ROW_COUNT,\n columnCount = MockTreeGridModel.DEFAULT_COLUMN_COUNT,\n children = new Map(),\n childRowCount = Math.ceil(\n Math.max(\n MockTreeGridModel.MIN_CHILD_ROW_COUNT,\n rowCount * MockTreeGridModel.DEFAULT_CHILD_ROW_COUNT_FACTOR\n )\n ),\n maxDepth = MockTreeGridModel.MAX_DEPTH,\n }: {\n children?: ChildrenTreeMap;\n columnCount?: number;\n rowCount?: number;\n childRowCount?: number;\n maxDepth?: number;\n } = {}) {\n super({ rowCount, columnCount });\n\n this.children = children;\n this.childRowCount = childRowCount;\n this.maxDepth = maxDepth;\n }\n\n textForCell(column: ModelIndex, row: ModelIndex): string {\n return this.getCachedTextForCell(this.children, column, row);\n }\n\n textForRowHeader(row: ModelIndex): string {\n return this.getCachedTextForRowHeader(this.children, row);\n }\n\n isRowMovable(row: ModelIndex): boolean {\n return false;\n }\n\n get hasExpandableRows(): boolean {\n return true;\n }\n\n get isExpandAllAvailable(): boolean {\n return false;\n }\n\n get floatingBottomRowCount(): number {\n return 0;\n }\n\n isRowExpandable(row: ModelIndex): boolean {\n return this.getCachedIsRowExpandable(this.children, row, this.maxDepth);\n }\n\n isRowExpanded(row: ModelIndex): boolean {\n return this.getCachedIsRowExpanded(this.children, row);\n }\n\n setRowExpanded(\n row: ModelIndex,\n isExpanded: boolean,\n expandDescendants = false\n ): void {\n const { key, offsetRow } = this.getCachedModelRowOffset(this.children, row);\n\n // We always set a new map so that our memoize functions work properly\n const children = new Map(this.children);\n if (key != null) {\n const model = this.children.get(key);\n if (model !== undefined) {\n const { rowCount: originalChildRowCount } = model;\n model.setRowExpanded(offsetRow, isExpanded, expandDescendants);\n this.numRows += model.rowCount - originalChildRowCount;\n }\n } else if (!isExpanded) {\n const childModel = children.get(offsetRow);\n if (childModel !== undefined) {\n this.numRows -= childModel.rowCount;\n children.delete(offsetRow);\n }\n } else {\n const child = new MockTreeGridModel({\n rowCount: this.childRowCount,\n columnCount: this.numColumns,\n });\n children.set(offsetRow, child);\n this.numRows += child.rowCount;\n }\n\n this.children = children;\n }\n\n expandAll(): void {\n throw new Error('Expand all not implemented.');\n }\n\n collapseAll(): void {\n throw new Error('Collapse all not implemented.');\n }\n\n depthForRow(row: ModelIndex): number {\n return this.getCachedDepthForRow(this.children, row);\n }\n\n /**\n * Returns the map key and the offsetRow given the provided children and row index.\n * If the returned key is null, then this offset row is within this model.\n * Only returning the key instead of the model so that memoize doesn't cache a bunch of the children models after they've been deleted (collapsed).\n */\n getCachedModelRowOffset = memoizeClear(\n (\n children: ChildrenTreeMap,\n row: ModelIndex\n ): { key: ModelIndex | null; offsetRow: ModelIndex } => {\n let key = null;\n let offsetRow = row;\n // Need to iterate through the map in order... sort it first\n const sortedEntries = [...children].sort((a, b) => a[0] - b[0]);\n for (let i = 0; i < sortedEntries.length; i += 1) {\n const [childRow, childModel] = sortedEntries[i];\n if (offsetRow <= childRow) {\n break;\n }\n const childRowCount = childModel.rowCount;\n if (offsetRow <= childRow + childRowCount) {\n key = childRow;\n offsetRow = offsetRow - childRow - 1;\n break;\n }\n offsetRow -= childRowCount;\n }\n\n return { key, offsetRow };\n },\n { max: 10000 }\n );\n\n getCachedTextForRowHeader = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex): string => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return `${key}.${model.textForRowHeader(offsetRow)}`;\n }\n }\n\n return `${offsetRow}`;\n },\n { max: 10000 }\n );\n\n getCachedTextForCell = memoizeClear(\n (\n children: ChildrenTreeMap,\n column: ModelIndex,\n row: ModelIndex\n ): string => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return `${key}.${model.textForCell(column, offsetRow)}`;\n }\n }\n\n return `${column},${offsetRow}`;\n },\n { max: 10000 }\n );\n\n getCachedIsRowExpandable = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex, maxDepth: number): boolean => {\n const depth = this.getCachedDepthForRow(children, row);\n\n return depth < maxDepth;\n },\n { max: 10000 }\n );\n\n getCachedIsRowExpanded = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex): boolean => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return model.isRowExpanded(offsetRow);\n }\n }\n\n return children.has(offsetRow);\n },\n { max: 10000 }\n );\n\n getCachedDepthForRow = memoizeClear(\n (children: ChildrenTreeMap, row: ModelIndex): number => {\n const { key, offsetRow } = this.getCachedModelRowOffset(children, row);\n\n if (key != null) {\n const model = children.get(key);\n if (model !== undefined) {\n return model.depthForRow(offsetRow) + 1;\n }\n }\n\n return 0;\n },\n { max: 10000 }\n );\n}\n\nexport default MockTreeGridModel;\n"],"mappings":";;;AAAA;AACA;AAAA,OACOA,aAAa;AAAA,OACbC,YAAY;AAMnB;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,SAASF,aAAa,CAAgC;EAK3E;;EAaAG,WAAWA,CAAA,EAiBH;IAAA,IAjBI;MACVC,QAAQ,GAAGF,iBAAiB,CAACG,iBAAiB;MAC9CC,WAAW,GAAGJ,iBAAiB,CAACK,oBAAoB;MACpDC,QAAQ,EAARA,SAAQ,GAAG,IAAIC,GAAG,CAAC,CAAC;MACpBC,aAAa,EAAbA,cAAa,GAAGC,IAAI,CAACC,IAAI,CACvBD,IAAI,CAACE,GAAG,CACNX,iBAAiB,CAACY,mBAAmB,EACrCV,QAAQ,GAAGF,iBAAiB,CAACa,8BAC/B,CACF,CAAC;MACDC,QAAQ,EAARA,SAAQ,GAAGd,iBAAiB,CAACe;IAO/B,CAAC,GAAAC,SAAA,CAAAC,MAAA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MAAM,IAAI,CAACF,UAAU,EAAE;MACtB,IAAMvB,UAAU,GAAGvB,QAAQ,CAAC0B,GAAG,CAACV,SAAS,CAAC;MAC1C,IAAIO,UAAU,KAAKX,SAAS,EAAE;QAC5B,IAAI,CAACqC,OAAO,IAAI1B,UAAU,CAAC3B,QAAQ;QACnCI,QAAQ,CAACkD,MAAM,CAAClC,SAAS,CAAC;MAC5B;IACF,CAAC,MAAM;MACL,IAAMmC,KAAK,GAAG,IAAIzD,iBAAiB,CAAC;QAClCE,QAAQ,EAAE,IAAI,CAACM,aAAa;QAC5BJ,WAAW,EAAE,IAAI,CAACsD;MACpB,CAAC,CAAC;MACFpD,QAAQ,CAACqD,GAAG,CAACrC,SAAS,EAAEmC,KAAK,CAAC;MAC9B,IAAI,CAACF,OAAO,IAAIE,KAAK,CAACvD,QAAQ;IAChC;IAEA,IAAI,CAACI,QAAQ,GAAGA,QAAQ;EAC1B;EAEAsD,SAASA,CAAA,EAAS;IAChB,MAAM,IAAIC,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEAC,WAAWA,CAAA,EAAS;IAClB,MAAM,IAAID,KAAK,CAAC,+BAA+B,CAAC;EAClD;EAEApB,WAAWA,CAACrB,GAAe,EAAU;IACnC,OAAO,IAAI,CAACkB,oBAAoB,CAAC,IAAI,CAAChC,QAAQ,EAAEc,GAAG,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;AAyGA;AAACD,eAAA,CAtOKnB,iBAAiB,uBACM,UAAU;AAAAmB,eAAA,CADjCnB,iBAAiB,0BAGS,GAAG;AAAAmB,eAAA,CAH7BnB,iBAAiB,oCAMmB,IAAI;AAAAmB,eAAA,CANxCnB,iBAAiB,yBAQQ,EAAE;AAAAmB,eAAA,CAR3BnB,iBAAiB,eAUF,EAAE;AA8NvB,eAAeA,iBAAiB"}
@@ -9,6 +9,8 @@ import memoizee from 'memoizee';
9
9
  * @param fn The function to memoize
10
10
  * @param options The options to set for memoization
11
11
  */
12
- export declare const memoizeClear: typeof memoizee;
12
+ export declare function memoizeClear<F extends Function>(fn: F, options: memoizee.Options<F> & {
13
+ max: number;
14
+ }): F & memoizee.Memoized<F>;
13
15
  export default memoizeClear;
14
16
  //# sourceMappingURL=memoizeClear.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memoizeClear.d.ts","sourceRoot":"","sources":["../src/memoizeClear.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,QAejC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"memoizeClear.d.ts","sourceRoot":"","sources":["../src/memoizeClear.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC;;;GAGG;AAEH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAC7C,EAAE,EAAE,CAAC,EACL,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAC7C,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAe1B;AAED,eAAe,YAAY,CAAC"}
@@ -15,7 +15,8 @@ import memoizee from 'memoizee';
15
15
  * @param fn The function to memoize
16
16
  * @param options The options to set for memoization
17
17
  */
18
- export var memoizeClear = (fn, options) => {
18
+ // eslint-disable-next-line @typescript-eslint/ban-types
19
+ export function memoizeClear(fn, options) {
19
20
  var isClearingCache = false;
20
21
  var memoizedFn = memoizee(fn, _objectSpread(_objectSpread({}, options), {}, {
21
22
  dispose: () => {
@@ -28,6 +29,6 @@ export var memoizeClear = (fn, options) => {
28
29
  }
29
30
  }));
30
31
  return memoizedFn;
31
- };
32
+ }
32
33
  export default memoizeClear;
33
34
  //# sourceMappingURL=memoizeClear.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memoizeClear.js","names":["memoizee","memoizeClear","fn","options","isClearingCache","memoizedFn","_objectSpread","dispose","clear"],"sources":["../src/memoizeClear.ts"],"sourcesContent":["/**\n * Extension of memoizee that clears the entire cache when it's full.\n * This avoids the situation where LRU cache starts thrashing when it fills up.\n * Could look at writing our own memoize with a smarter cache to avoid overhead of\n * LRU queue, but this should be sufficient for now.\n */\nimport memoizee from 'memoizee';\n\n/**\n * @param fn The function to memoize\n * @param options The options to set for memoization\n */\nexport const memoizeClear: typeof memoizee = (fn, options) => {\n let isClearingCache = false;\n const memoizedFn = memoizee(fn, {\n ...options,\n dispose: () => {\n // Need to track when we're clearing because dispose gets called for all items removed\n if (!isClearingCache) {\n isClearingCache = true;\n memoizedFn.clear();\n isClearingCache = false;\n }\n },\n });\n\n return memoizedFn;\n};\n\nexport default memoizeClear;\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,UAAU;;AAE/B;AACA;AACA;AACA;AACA,OAAO,IAAMC,YAA6B,GAAGA,CAACC,EAAE,EAAEC,OAAO,KAAK;EAC5D,IAAIC,eAAe,GAAG,KAAK;EAC3B,IAAMC,UAAU,GAAGL,QAAQ,CAACE,EAAE,EAAAI,aAAA,CAAAA,aAAA,KACzBH,OAAO;IACVI,OAAO,EAAEA,CAAA,KAAM;MACb;MACA,IAAI,CAACH,eAAe,EAAE;QACpBA,eAAe,GAAG,IAAI;QACtBC,UAAU,CAACG,KAAK,CAAC,CAAC;QAClBJ,eAAe,GAAG,KAAK;MACzB;IACF;EAAC,EACF,CAAC;EAEF,OAAOC,UAAU;AACnB,CAAC;AAED,eAAeJ,YAAY"}
1
+ {"version":3,"file":"memoizeClear.js","names":["memoizee","memoizeClear","fn","options","isClearingCache","memoizedFn","_objectSpread","dispose","clear"],"sources":["../src/memoizeClear.ts"],"sourcesContent":["/**\n * Extension of memoizee that clears the entire cache when it's full.\n * This avoids the situation where LRU cache starts thrashing when it fills up.\n * Could look at writing our own memoize with a smarter cache to avoid overhead of\n * LRU queue, but this should be sufficient for now.\n */\nimport memoizee from 'memoizee';\n\n/**\n * @param fn The function to memoize\n * @param options The options to set for memoization\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function memoizeClear<F extends Function>(\n fn: F,\n options: memoizee.Options<F> & { max: number }\n): F & memoizee.Memoized<F> {\n let isClearingCache = false;\n const memoizedFn = memoizee(fn, {\n ...options,\n dispose: () => {\n // Need to track when we're clearing because dispose gets called for all items removed\n if (!isClearingCache) {\n isClearingCache = true;\n memoizedFn.clear();\n isClearingCache = false;\n }\n },\n });\n\n return memoizedFn;\n}\n\nexport default memoizeClear;\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,UAAU;;AAE/B;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC1BC,EAAK,EACLC,OAA8C,EACpB;EAC1B,IAAIC,eAAe,GAAG,KAAK;EAC3B,IAAMC,UAAU,GAAGL,QAAQ,CAACE,EAAE,EAAAI,aAAA,CAAAA,aAAA,KACzBH,OAAO;IACVI,OAAO,EAAEA,CAAA,KAAM;MACb;MACA,IAAI,CAACH,eAAe,EAAE;QACpBA,eAAe,GAAG,IAAI;QACtBC,UAAU,CAACG,KAAK,CAAC,CAAC;QAClBJ,eAAe,GAAG,KAAK;MACzB;IACF;EAAC,EACF,CAAC;EAEF,OAAOC,UAAU;AACnB;AAEA,eAAeJ,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/grid",
3
- "version": "0.106.1",
3
+ "version": "0.106.2",
4
4
  "description": "Deephaven React grid component",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "652212e32b5bd2bbeed6ac9bed774b083c89feb5"
47
+ "gitHead": "d595d88499eeb036f23c31a3a94fcbd677ea7ee5"
48
48
  }