canvas-datagrid 0.3.14 → 0.3.15

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 CHANGED
@@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## 0.3.14 - 2021-10-20
11
11
 
12
+ ### Fixed
13
+
14
+ - Fix highlighting incorrect column after repositioning column (xianzhi3, #399)
15
+ - Reverse sort order icon (faimaklg, #387)
16
+ - Fix link in tutorials (slominskir, #386)
17
+
18
+ ## 0.3.14 - 2021-10-20
19
+
12
20
  ### Added
13
21
 
14
22
  - Emit affected cells in `cut` event (mdebrauw, #383)
@@ -1892,15 +1892,15 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
1892
1892
  y = y + mt;
1893
1893
 
1894
1894
  if (self.orderDirection === 'asc') {
1895
- self.ctx.moveTo(x, y);
1896
- self.ctx.lineTo(x + aw, y);
1897
- self.ctx.lineTo(x + aw * 0.5, y + ah);
1898
- self.ctx.moveTo(x, y);
1899
- } else {
1900
1895
  self.ctx.lineTo(x, y + ah);
1901
1896
  self.ctx.lineTo(x + aw, y + ah);
1902
1897
  self.ctx.lineTo(x + aw * 0.5, y);
1903
1898
  self.ctx.lineTo(x, y + ah);
1899
+ } else {
1900
+ self.ctx.moveTo(x, y);
1901
+ self.ctx.lineTo(x + aw, y);
1902
+ self.ctx.lineTo(x + aw * 0.5, y + ah);
1903
+ self.ctx.moveTo(x, y);
1904
1904
  }
1905
1905
 
1906
1906
  self.ctx.stroke();
@@ -4365,6 +4365,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4365
4365
  self.stopDragReorder = function (e) {
4366
4366
  var oIndex,
4367
4367
  tIndex,
4368
+ odata,
4368
4369
  cr = {
4369
4370
  'row-reorder': self.orders.rows,
4370
4371
  'column-reorder': self.orders.columns
@@ -4385,13 +4386,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4385
4386
  self.ignoreNextClick = true;
4386
4387
  oIndex = cr[self.dragMode].indexOf(self.reorderObject[i]);
4387
4388
  tIndex = cr[self.dragMode].indexOf(self.reorderTarget[i]);
4388
- cr[self.dragMode].splice(oIndex, 1);
4389
- cr[self.dragMode].splice(tIndex, 0, self.reorderObject[i]);
4390
4389
 
4391
4390
  if (self.dragMode === 'column-reorder') {
4391
+ cr[self.dragMode].splice(oIndex, 1);
4392
+ cr[self.dragMode].splice(tIndex, 0, self.reorderObject[i]);
4392
4393
  self.orders.columns = cr[self.dragMode];
4393
4394
  } else {
4394
- self.orders.rows = cr[self.dragMode];
4395
+ // self.orders.rows = cr[self.dragMode];
4396
+ odata = self.viewData[oIndex];
4397
+ self.viewData[oIndex] = self.viewData[tIndex];
4398
+ self.viewData[tIndex] = odata;
4395
4399
  }
4396
4400
 
4397
4401
  self.resize();
@@ -4617,6 +4621,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4617
4621
 
4618
4622
  if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {
4619
4623
  self.draggingItem = self.dragStartObject;
4624
+
4625
+ if (self.dragMode === 'column-reorder' && self.attributes.columnHeaderClickBehavior === 'select') {
4626
+ self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
4627
+ self.draw();
4628
+ }
4629
+
4620
4630
  document.body.addEventListener('mousemove', self.dragReorder, false);
4621
4631
  document.body.addEventListener('mouseup', self.stopDragReorder, false);
4622
4632
  return;
@@ -4625,9 +4635,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4625
4635
 
4626
4636
  self.mouseup = function (e) {
4627
4637
  clearTimeout(self.scrollTimer);
4638
+ var ctrl = e.ctrlKey || e.metaKey;
4628
4639
  self.cellBoundaryCrossed = true;
4629
4640
  self.rowBoundaryCrossed = true;
4630
4641
  self.columnBoundaryCrossed = true;
4642
+
4643
+ if (self.draggingItem) {
4644
+ self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
4645
+ self.draw();
4646
+ }
4647
+
4631
4648
  self.selecting = undefined;
4632
4649
  self.draggingItem = undefined;
4633
4650
  self.dragStartObject = undefined;