canvas-datagrid 0.3.24 → 0.3.25

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/lib/dom.js CHANGED
@@ -143,11 +143,16 @@ export default function (self) {
143
143
  s = e,
144
144
  h,
145
145
  w;
146
+ let calculatedTree = false;
146
147
  while (e.offsetParent && e.nodeName !== 'CANVAS-DATAGRID') {
147
- x += e.offsetLeft;
148
- y += e.offsetTop;
149
- h = e.offsetHeight;
150
- w = e.offsetWidth;
148
+ const isTree = e.nodeType === 'canvas-datagrid-tree';
149
+ if (!isTree || !calculatedTree) {
150
+ x += e.offsetLeft;
151
+ y += e.offsetTop;
152
+ h = e.offsetHeight;
153
+ w = e.offsetWidth;
154
+ }
155
+ if (isTree) calculatedTree = true;
151
156
  e = e.offsetParent;
152
157
  }
153
158
  if (ignoreScrollOffset) {
@@ -975,6 +975,7 @@ export default function (self) {
975
975
  -1,
976
976
  self.activeCell.rowIndex,
977
977
  );
978
+ if (!self.reorderObject) return;
978
979
  self.reorderTarget = self.currentCell;
979
980
  self.reorderObject.dragOffset = {
980
981
  x: x,
@@ -87,7 +87,8 @@ const parseData = function (data, mimeType) {
87
87
  };
88
88
 
89
89
  const htmlSafe = function (value) {
90
- if (typeof value === 'number') return value;
90
+ if (typeof value !== 'string') return value;
91
+
91
92
  return value.replace(/</g, '&lt;').replace(/>/g, '&gt;');
92
93
  };
93
94
 
@@ -342,18 +342,25 @@ export default function (self) {
342
342
  * @param {number} [offsetY=0] Percentage offset the cell should be from the top edge (not including headers). The default is 0, meaning the cell will appear at the top edge. Valid values are 0 through 1. 1 = Bottom, 0 = Top, 0.5 = Center.
343
343
  */
344
344
  self.scrollIntoView = function (x, y, offsetX, offsetY) {
345
- if (
346
- self.visibleCells.filter(function (cell) {
347
- return (
348
- (cell.rowIndex === y || y === undefined) &&
349
- (cell.columnIndex === x || x === undefined) &&
350
- cell.x > 0 &&
351
- cell.y > 0 &&
352
- cell.x + cell.width < self.width &&
353
- cell.y + cell.height < self.height
354
- );
355
- }).length === 0
356
- ) {
345
+ const matched = self.visibleCells.filter(function (cell) {
346
+ return (
347
+ (cell.rowIndex === y || y === undefined) &&
348
+ (cell.columnIndex === x || x === undefined) &&
349
+ cell.x > 0 &&
350
+ cell.y > 0 &&
351
+ cell.x + cell.width < self.width &&
352
+ cell.y + cell.height < self.height
353
+ );
354
+ });
355
+ if (matched.length === 1 && x !== undefined && y !== undefined) {
356
+ // goto specific cell and its part be hidden by header
357
+ if (
358
+ matched[0].x < self.getRowHeaderCellWidth() ||
359
+ matched[0].y < self.getColumnHeaderCellHeight()
360
+ )
361
+ matched.length = 0;
362
+ }
363
+ if (matched.length === 0) {
357
364
  self.gotoCell(x, y, offsetX, offsetY);
358
365
  }
359
366
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-datagrid",
3
- "version": "0.3.24",
3
+ "version": "0.3.25",
4
4
  "description": "Canvas based data grid web component. Capable of displaying millions of contiguous hierarchical rows and columns without paging or loading, on a single canvas element.",
5
5
  "main": "./dist/canvas-datagrid.js",
6
6
  "module": "./dist/canvas-datagrid.module.js",