canvas-datagrid 0.4.0 → 0.4.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/CHANGELOG.md +7 -0
- package/dist/canvas-datagrid.debug.js +49 -10
- package/dist/canvas-datagrid.debug.map +1 -1
- package/dist/canvas-datagrid.js +1 -1
- package/dist/canvas-datagrid.module.js +1 -1
- package/dist/canvas-datagrid.module.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/lib/contextMenu.js +6 -1
- package/lib/defaults.js +1 -0
- package/lib/draw.js +1 -0
- package/lib/events/index.js +44 -1
- package/lib/publicMethods.js +16 -2
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -621,11 +621,13 @@ declare class canvasDatagrid {
|
|
|
621
621
|
*/
|
|
622
622
|
static getVisibleCellByIndex(x: number, y: number): cell;
|
|
623
623
|
/**
|
|
624
|
+
* Get a column group at grid pixel coordinate x and y.
|
|
624
625
|
* @param x - Number of pixels from the left.
|
|
625
626
|
* @param y - Number of pixels from the top.
|
|
626
627
|
*/
|
|
627
628
|
static getColumnGroupAt(x: number, y: number): void;
|
|
628
629
|
/**
|
|
630
|
+
* Get a row group at grid pixel coordinate x and y.
|
|
629
631
|
* @param x - Number of pixels from the left.
|
|
630
632
|
* @param y - Number of pixels from the top.
|
|
631
633
|
*/
|
package/lib/contextMenu.js
CHANGED
|
@@ -609,13 +609,18 @@ export default function (self) {
|
|
|
609
609
|
},
|
|
610
610
|
});
|
|
611
611
|
if (e.cell && e.cell.header && e.cell.columnIndex > -1) {
|
|
612
|
+
// This variable represents the order index because of the following codes from `draw.js`:
|
|
613
|
+
// columnIndex: columnOrderIndex,
|
|
614
|
+
const columnOrderIndex = e.cell.columnIndex;
|
|
615
|
+
const columnIndex = self.orders.columns[columnOrderIndex];
|
|
616
|
+
|
|
612
617
|
e.items.push({
|
|
613
618
|
title: self.attributes.hideColumnText.replace(
|
|
614
619
|
/%s/gi,
|
|
615
620
|
e.cell.header.title || e.cell.header.name,
|
|
616
621
|
),
|
|
617
622
|
click: function (ev) {
|
|
618
|
-
self.getSchema()[
|
|
623
|
+
self.getSchema()[columnIndex].hidden = true;
|
|
619
624
|
ev.preventDefault();
|
|
620
625
|
self.stopPropagation(ev);
|
|
621
626
|
self.disposeContextMenu();
|
package/lib/defaults.js
CHANGED
package/lib/draw.js
CHANGED
|
@@ -2359,6 +2359,7 @@ export default function (self) {
|
|
|
2359
2359
|
self.ctx.restore();
|
|
2360
2360
|
}
|
|
2361
2361
|
function drawFrozenMarkers() {
|
|
2362
|
+
if (self.dragStartObject !== undefined) return;
|
|
2362
2363
|
var my = self.lastFrozenRowPixel - self.style.frozenMarkerWidth,
|
|
2363
2364
|
mx = self.lastFrozenColumnPixel - self.style.frozenMarkerBorderWidth,
|
|
2364
2365
|
xHover =
|
package/lib/events/index.js
CHANGED
|
@@ -568,7 +568,24 @@ export default function (self) {
|
|
|
568
568
|
dragBounds.right = s.length - 1;
|
|
569
569
|
dragBounds.top = Math.min(sBounds.top, cell.rowIndex);
|
|
570
570
|
dragBounds.bottom = Math.max(sBounds.bottom, cell.rowIndex);
|
|
571
|
+
if (dragBounds.top < 0) dragBounds.top = 0;
|
|
571
572
|
}
|
|
573
|
+
|
|
574
|
+
if (self.dragStartObject.rowIndex === -1) {
|
|
575
|
+
sBounds = self.getSelectionBounds();
|
|
576
|
+
dragBounds.left =
|
|
577
|
+
cell.columnIndex === undefined
|
|
578
|
+
? sBounds.left
|
|
579
|
+
: Math.min(sBounds.left, cell.columnIndex);
|
|
580
|
+
dragBounds.right =
|
|
581
|
+
cell.columnIndex === undefined
|
|
582
|
+
? sBounds.right
|
|
583
|
+
: Math.max(sBounds.right, cell.columnIndex);
|
|
584
|
+
dragBounds.top = -1;
|
|
585
|
+
dragBounds.bottom = self.viewData.length - 1;
|
|
586
|
+
if (dragBounds.left < 0) dragBounds.left = 0;
|
|
587
|
+
}
|
|
588
|
+
|
|
572
589
|
if (
|
|
573
590
|
self.dragStartObject.rowIndex !== cell.rowIndex ||
|
|
574
591
|
self.dragStartObject.columnIndex !== cell.columnIndex
|
|
@@ -581,11 +598,31 @@ export default function (self) {
|
|
|
581
598
|
self.attributes.selectionMode === 'row'
|
|
582
599
|
) {
|
|
583
600
|
if (
|
|
601
|
+
cell.rowIndex !== undefined &&
|
|
584
602
|
(self.attributes.selectionMode === 'row' ||
|
|
585
603
|
self.dragStartObject.columnIndex === -1) &&
|
|
586
604
|
self.rowBoundaryCrossed
|
|
587
605
|
) {
|
|
588
|
-
self.
|
|
606
|
+
if (self.dragStartObject.rowIndex < cell.rowIndex) {
|
|
607
|
+
dragBounds.top = self.dragStartObject.rowIndex;
|
|
608
|
+
dragBounds.bottom = cell.rowIndex;
|
|
609
|
+
} else {
|
|
610
|
+
dragBounds.top = cell.rowIndex;
|
|
611
|
+
dragBounds.bottom = self.dragStartObject.rowIndex;
|
|
612
|
+
}
|
|
613
|
+
} else if (
|
|
614
|
+
cell.rowIndex !== undefined &&
|
|
615
|
+
(self.attributes.selectionMode === 'column' ||
|
|
616
|
+
self.dragStartObject.rowIndex === -1) &&
|
|
617
|
+
self.columnBoundaryCrossed
|
|
618
|
+
) {
|
|
619
|
+
if (self.dragStartObject.columnIndex < cell.columnIndex) {
|
|
620
|
+
dragBounds.left = self.dragStartObject.columnIndex;
|
|
621
|
+
dragBounds.right = cell.columnIndex;
|
|
622
|
+
} else {
|
|
623
|
+
dragBounds.left = cell.columnIndex;
|
|
624
|
+
dragBounds.right = self.dragStartObject.columnIndex;
|
|
625
|
+
}
|
|
589
626
|
} else if (self.attributes.selectionMode !== 'row') {
|
|
590
627
|
if (cell.hovered && self.hovers.onFilterButton) {
|
|
591
628
|
if (cell.openedFilter) {
|
|
@@ -1372,6 +1409,12 @@ export default function (self) {
|
|
|
1372
1409
|
self.dragStartObject.rowIndex > -1
|
|
1373
1410
|
) {
|
|
1374
1411
|
self.selectRow(self.dragStartObject.rowIndex, ctrl, null);
|
|
1412
|
+
} else if (
|
|
1413
|
+
(self.attributes.selectionMode === 'column' ||
|
|
1414
|
+
self.dragStartObject.rowIndex === -1) &&
|
|
1415
|
+
self.dragStartObject.columnIndex > -1
|
|
1416
|
+
) {
|
|
1417
|
+
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
1375
1418
|
} else if (self.attributes.selectionMode !== 'row') {
|
|
1376
1419
|
self.mousemove(e);
|
|
1377
1420
|
}
|
package/lib/publicMethods.js
CHANGED
|
@@ -1337,6 +1337,7 @@ export default function (self) {
|
|
|
1337
1337
|
})[0];
|
|
1338
1338
|
};
|
|
1339
1339
|
/**
|
|
1340
|
+
* Get a column group at grid pixel coordinate x and y.
|
|
1340
1341
|
* @memberof canvasDatagrid
|
|
1341
1342
|
* @name getColumnGroupAt
|
|
1342
1343
|
* @method
|
|
@@ -1355,6 +1356,7 @@ export default function (self) {
|
|
|
1355
1356
|
}
|
|
1356
1357
|
};
|
|
1357
1358
|
/**
|
|
1359
|
+
* Get a row group at grid pixel coordinate x and y.
|
|
1358
1360
|
* @memberof canvasDatagrid
|
|
1359
1361
|
* @name getRowGroupAt
|
|
1360
1362
|
* @method
|
|
@@ -1563,8 +1565,20 @@ export default function (self) {
|
|
|
1563
1565
|
}
|
|
1564
1566
|
}
|
|
1565
1567
|
if (cell.style === 'columnHeaderCell') {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
+
if (
|
|
1569
|
+
cell.x +
|
|
1570
|
+
cell.width -
|
|
1571
|
+
self.attributes.columnGrabZoneSize -
|
|
1572
|
+
self.style.cellBorderWidth >
|
|
1573
|
+
x ||
|
|
1574
|
+
!self.attributes.allowRowReordering
|
|
1575
|
+
) {
|
|
1576
|
+
cell.dragContext = 'cell';
|
|
1577
|
+
cell.context = 'cell';
|
|
1578
|
+
} else {
|
|
1579
|
+
cell.context = self.cursorGrab;
|
|
1580
|
+
cell.dragContext = 'column-reorder';
|
|
1581
|
+
}
|
|
1568
1582
|
return cell;
|
|
1569
1583
|
}
|
|
1570
1584
|
if (cell.style === 'rowHeaderCell') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canvas-datagrid",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|