jquery.dgtable 0.6.13 → 0.6.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.
@@ -1,11 +1,12 @@
1
1
  /*!
2
- * jquery.dgtable 0.6.13
2
+ * jquery.dgtable 0.6.15
3
3
  * git://github.com/danielgindi/jquery.dgtable.git
4
4
  */
5
5
  'use strict';
6
6
 
7
7
  var jQuery = require('jquery');
8
- var ScrollHelper = require('@danielgindi/dom-utils/lib/ScrollHelper');
8
+ var ScrollHelper_js = require('@danielgindi/dom-utils/lib/ScrollHelper.js');
9
+ var Css_js = require('@danielgindi/dom-utils/lib/Css.js');
9
10
  var Css = require('@danielgindi/dom-utils/lib/Css');
10
11
 
11
12
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2052,11 +2053,6 @@ RowCollection.prototype.onComparatorRequired = null;
2052
2053
  */
2053
2054
  RowCollection.prototype.customSortingProvider = null;
2054
2055
 
2055
- /**
2056
- * @type {Function|null|undefined}
2057
- */
2058
- RowCollection.prototype.onSort = null;
2059
-
2060
2056
  let nativeSort = RowCollection.prototype.sort;
2061
2057
 
2062
2058
  function getDefaultComparator(column, descending) {
@@ -2088,10 +2084,9 @@ function getDefaultComparator(column, descending) {
2088
2084
  }
2089
2085
 
2090
2086
  /**
2091
- * @param {Boolean=false} silent
2092
2087
  * @returns {Function|undefined} the comparator that was used
2093
2088
  */
2094
- RowCollection.prototype.sort = function (silent) {
2089
+ RowCollection.prototype.sort = function () {
2095
2090
  let comparator;
2096
2091
 
2097
2092
  if (this.sortColumn.length) {
@@ -2136,12 +2131,6 @@ RowCollection.prototype.sort = function (silent) {
2136
2131
  } else {
2137
2132
  sorter(this);
2138
2133
  }
2139
-
2140
- if (!silent) {
2141
- if (this.onSort) {
2142
- this.onSort(comparator);
2143
- }
2144
- }
2145
2134
  }
2146
2135
 
2147
2136
  return comparator;
@@ -4606,7 +4595,7 @@ DGTable.prototype.render = function () {
4606
4595
  }
4607
4596
 
4608
4597
  let lastScrollTop = p.table && p.table.parentNode ? p.table.scrollTop : NaN,
4609
- lastScrollHorz = p.table && p.table.parentNode ? ScrollHelper.getScrollHorz(p.table) : NaN;
4598
+ lastScrollHorz = p.table && p.table.parentNode ? ScrollHelper_js.getScrollHorz(p.table) : NaN;
4610
4599
 
4611
4600
  this._renderSkeletonBase().
4612
4601
  _renderSkeletonBody().
@@ -4633,8 +4622,8 @@ DGTable.prototype.render = function () {
4633
4622
  p.table.scrollTop = lastScrollTop;
4634
4623
 
4635
4624
  if (!isNaN(lastScrollHorz)) {
4636
- ScrollHelper.setScrollHorz(p.table, lastScrollHorz);
4637
- ScrollHelper.setScrollHorz(p.header, lastScrollHorz);
4625
+ ScrollHelper_js.setScrollHorz(p.table, lastScrollHorz);
4626
+ ScrollHelper_js.setScrollHorz(p.header, lastScrollHorz);
4638
4627
  }
4639
4628
 
4640
4629
  this.trigger('renderskeleton');
@@ -4715,7 +4704,7 @@ DGTable.prototype._calculateTbodyWidth = function () {
4715
4704
  let hasFractions = Math.round(fractionValue) !== fractionValue;
4716
4705
  fractionTest.remove();
4717
4706
 
4718
- let width = Css.getElementWidth($row[0], true, true, true);
4707
+ let width = Css_js.getElementWidth($row[0], true, true, true);
4719
4708
  width -= p.scrollbarWidth || 0;
4720
4709
 
4721
4710
  if (hasFractions) {
@@ -5691,7 +5680,7 @@ DGTable.prototype._calculateWidthAvailableForColumns = function () {
5691
5680
  }
5692
5681
  }
5693
5682
 
5694
- let detectedWidth = Css.getElementWidth(this.$el[0]);
5683
+ let detectedWidth = Css_js.getElementWidth(this.$el[0]);
5695
5684
 
5696
5685
  if (p.table) {
5697
5686
  if (o.virtualTable) {
@@ -5767,7 +5756,7 @@ DGTable.prototype.tableWidthChanged = function () {
5767
5756
  ).css({ 'position': 'absolute', top: '-9999px', 'visibility': 'hidden' });
5768
5757
  $tableWrapper.appendTo(document.body);
5769
5758
 
5770
- let width = Css.getElementWidth($cell[0]);
5759
+ let width = Css_js.getElementWidth($cell[0]);
5771
5760
 
5772
5761
  $tableWrapper.remove();
5773
5762
 
@@ -6019,7 +6008,7 @@ DGTable.prototype.tableHeightChanged = function () {
6019
6008
  return that;
6020
6009
  }
6021
6010
 
6022
- let height = Css.getElementHeight(that.$el[0], true) - (
6011
+ let height = Css_js.getElementHeight(that.$el[0], true) - (
6023
6012
  parseFloat(p.$table.css('border-top-width')) || 0) // Subtract top border of inner element
6024
6013
  - (parseFloat(p.$table.css('border-bottom-width')) || 0); // Subtract bottom border of inner element
6025
6014
 
@@ -6029,7 +6018,7 @@ DGTable.prototype.tableHeightChanged = function () {
6029
6018
 
6030
6019
  if (p.tbody) {
6031
6020
  // At least 1 pixel - to show scrollers correctly.
6032
- p.tbody.style.height = Math.max(o.height - Css.getElementHeight(p.$headerRow[0], true, true, true), 1) + 'px';
6021
+ p.tbody.style.height = Math.max(o.height - Css_js.getElementHeight(p.$headerRow[0], true, true, true), 1) + 'px';
6033
6022
  }
6034
6023
 
6035
6024
  if (o.virtualTable) {
@@ -6423,7 +6412,7 @@ DGTable.prototype._getColumnByResizePosition = function (e) {
6423
6412
  let mouseX = ((e.pageX != null ? e.pageX : e.originalEvent.pageX) || e.originalEvent.clientX) - $headerCell.offset().left;
6424
6413
 
6425
6414
  if (rtl) {
6426
- if (!firstCol && Css.getElementWidth($headerCell[0], true, true, true) - mouseX <= o.resizeAreaWidth / 2) {
6415
+ if (!firstCol && Css_js.getElementWidth($headerCell[0], true, true, true) - mouseX <= o.resizeAreaWidth / 2) {
6427
6416
  return previousElementSibling['columnName'];
6428
6417
  } else if (mouseX <= o.resizeAreaWidth / 2) {
6429
6418
  return headerCell['columnName'];
@@ -6431,7 +6420,7 @@ DGTable.prototype._getColumnByResizePosition = function (e) {
6431
6420
  } else {
6432
6421
  if (!firstCol && mouseX <= o.resizeAreaWidth / 2) {
6433
6422
  return previousElementSibling['columnName'];
6434
- } else if (Css.getElementWidth($headerCell[0], true, true, true) - mouseX <= o.resizeAreaWidth / 2) {
6423
+ } else if (Css_js.getElementWidth($headerCell[0], true, true, true) - mouseX <= o.resizeAreaWidth / 2) {
6435
6424
  return headerCell['columnName'];
6436
6425
  }
6437
6426
  }
@@ -6590,12 +6579,12 @@ DGTable.prototype._onMouseDownColumnHeader = function (event) {
6590
6579
  posCol.left -= posRelative.left;
6591
6580
  posCol.top -= posRelative.top;
6592
6581
  posCol.top -= parseFloat(selectedHeaderCell.css('border-top-width')) || 0;
6593
- let resizerWidth = Css.getElementWidth(p.$resizer[0], true, true, true);
6582
+ let resizerWidth = Css_js.getElementWidth(p.$resizer[0], true, true, true);
6594
6583
  if (rtl) {
6595
6584
  posCol.left -= Math.ceil((parseFloat(selectedHeaderCell.css('border-left-width')) || 0) / 2);
6596
6585
  posCol.left -= Math.ceil(resizerWidth / 2);
6597
6586
  } else {
6598
- posCol.left += Css.getElementWidth(selectedHeaderCell[0], true, true, true);
6587
+ posCol.left += Css_js.getElementWidth(selectedHeaderCell[0], true, true, true);
6599
6588
  posCol.left += Math.ceil((parseFloat(selectedHeaderCell.css('border-right-width')) || 0) / 2);
6600
6589
  posCol.left -= Math.ceil(resizerWidth / 2);
6601
6590
  }
@@ -6606,7 +6595,7 @@ DGTable.prototype._onMouseDownColumnHeader = function (event) {
6606
6595
  'visibility': 'visible',
6607
6596
  'left': posCol.left,
6608
6597
  'top': posCol.top,
6609
- 'height': Css.getElementHeight(this.$el[0])
6598
+ 'height': Css_js.getElementHeight(this.$el[0])
6610
6599
  })[0]['columnName'] = selectedHeaderCell[0]['columnName'];
6611
6600
 
6612
6601
  try {p.$resizer[0].style.zIndex = '';}
@@ -6647,8 +6636,8 @@ DGTable.prototype._onMouseUpColumnHeader = function (event) {
6647
6636
  let o = this.o;
6648
6637
  let $headerCell = $(event.target).closest('div.' + o.tableClassName + '-header-cell,div.' + o.cellPreviewClassName);
6649
6638
  let bounds = $headerCell.offset();
6650
- bounds['width'] = Css.getElementWidth($headerCell[0], true, true, true);
6651
- bounds['height'] = Css.getElementHeight($headerCell[0], true, true, true);
6639
+ bounds['width'] = Css_js.getElementWidth($headerCell[0], true, true, true);
6640
+ bounds['height'] = Css_js.getElementHeight($headerCell[0], true, true, true);
6652
6641
  this.trigger('headercontextmenu', $headerCell[0]['columnName'], event.pageX, event.pageY, bounds);
6653
6642
  }
6654
6643
  return this;
@@ -6754,7 +6743,7 @@ DGTable.prototype._onMouseMoveResizeArea = function (event) {
6754
6743
  let posCol = selectedHeaderCell.offset(),posRelative = commonAncestor.offset();
6755
6744
  posRelative.left += parseFloat(commonAncestor.css('border-left-width')) || 0;
6756
6745
  posCol.left -= posRelative.left;
6757
- let resizerWidth = Css.getElementWidth(p.$resizer[0], true, true, true);
6746
+ let resizerWidth = Css_js.getElementWidth(p.$resizer[0], true, true, true);
6758
6747
 
6759
6748
  let isBoxing = selectedHeaderCell.css('box-sizing') === 'border-box';
6760
6749
 
@@ -6764,7 +6753,7 @@ DGTable.prototype._onMouseMoveResizeArea = function (event) {
6764
6753
  minX -= Math.ceil(resizerWidth / 2);
6765
6754
 
6766
6755
  if (rtl) {
6767
- minX += Css.getElementWidth(selectedHeaderCell[0], true, true, true);
6756
+ minX += Css_js.getElementWidth(selectedHeaderCell[0], true, true, true);
6768
6757
  minX -= column.ignoreMin ? 0 : this.o.minColumnWidth;
6769
6758
 
6770
6759
  if (!isBoxing) {
@@ -6816,7 +6805,7 @@ DGTable.prototype._onEndDragColumnHeader = function (event) {
6816
6805
  let posCol = selectedHeaderCell.offset(),posRelative = commonAncestor.offset();
6817
6806
  posRelative.left += parseFloat(commonAncestor.css('border-left-width')) || 0;
6818
6807
  posCol.left -= posRelative.left;
6819
- let resizerWidth = Css.getElementWidth(p.$resizer[0], true, true, true);
6808
+ let resizerWidth = Css_js.getElementWidth(p.$resizer[0], true, true, true);
6820
6809
 
6821
6810
  let isBoxing = selectedHeaderCell.css('box-sizing') === 'border-box';
6822
6811
 
@@ -6835,7 +6824,7 @@ DGTable.prototype._onEndDragColumnHeader = function (event) {
6835
6824
  actualX += column.arrowProposedWidth || 0; // Sort-arrow width
6836
6825
  }
6837
6826
 
6838
- baseX += Css.getElementWidth(selectedHeaderCell[0], true, true, true);
6827
+ baseX += Css_js.getElementWidth(selectedHeaderCell[0], true, true, true);
6839
6828
 
6840
6829
  minX = baseX - (column.ignoreMin ? 0 : this.o.minColumnWidth);
6841
6830
  if (actualX > minX) {
@@ -7140,7 +7129,7 @@ DGTable.prototype._renderSkeletonBase = function () {var _p$virtualListHelper2;
7140
7129
  }
7141
7130
 
7142
7131
  if (!o.height && o.virtualTable) {
7143
- o.height = Css.getElementHeight(this.$el[0], true);
7132
+ o.height = Css_js.getElementHeight(this.$el[0], true);
7144
7133
  }
7145
7134
 
7146
7135
  return this;
@@ -7265,9 +7254,9 @@ DGTable.prototype._renderSkeletonBody = function () {
7265
7254
  let row1 = createDummyRow(),row2 = createDummyRow(),row3 = createDummyRow();
7266
7255
  $dummyTbody.append(row1, row2, row3);
7267
7256
 
7268
- p.virtualRowHeightFirst = Css.getElementHeight(row1, true, true, true);
7269
- p.virtualRowHeight = Css.getElementHeight(row2, true, true, true);
7270
- p.virtualRowHeightLast = Css.getElementHeight(row3, true, true, true);
7257
+ p.virtualRowHeightFirst = Css_js.getElementHeight(row1, true, true, true);
7258
+ p.virtualRowHeight = Css_js.getElementHeight(row2, true, true, true);
7259
+ p.virtualRowHeightLast = Css_js.getElementHeight(row3, true, true, true);
7271
7260
 
7272
7261
  $dummyWrapper.remove();
7273
7262
  }
@@ -7286,7 +7275,7 @@ DGTable.prototype._renderSkeletonBody = function () {
7286
7275
  table.className += ' virtual';
7287
7276
  }
7288
7277
 
7289
- let tableHeight = o.height - Css.getElementHeight(p.$headerRow[0], true, true, true);
7278
+ let tableHeight = o.height - Css_js.getElementHeight(p.$headerRow[0], true, true, true);
7290
7279
  if ($table.css('box-sizing') !== 'border-box') {
7291
7280
  tableHeight -= parseFloat($table.css('border-top-width')) || 0;
7292
7281
  tableHeight -= parseFloat($table.css('border-bottom-width')) || 0;
@@ -7408,8 +7397,8 @@ DGTable.prototype._updateTableWidth = function (parentSizeMayHaveChanged) {
7408
7397
  if (o.width === DGTable.Width.AUTO) {
7409
7398
  // Update wrapper element's size to fully contain the table body
7410
7399
 
7411
- Css.setElementWidth(p.$table[0], Css.getElementWidth(p.tbody, true, true, true));
7412
- Css.setElementWidth(this.$el[0], Css.getElementWidth(p.$table[0], true, true, true));
7400
+ Css_js.setElementWidth(p.$table[0], Css_js.getElementWidth(p.tbody, true, true, true));
7401
+ Css_js.setElementWidth(this.$el[0], Css_js.getElementWidth(p.$table[0], true, true, true));
7413
7402
 
7414
7403
  } else if (o.width === DGTable.Width.SCROLL) {
7415
7404
 
@@ -7530,7 +7519,7 @@ DGTable.prototype._cellMouseOverEvent = function (el) {
7530
7519
  let css = {
7531
7520
  'box-sizing': borderBox ? 'border-box' : 'content-box',
7532
7521
  'width': requiredWidth,
7533
- 'min-height': Css.getElementHeight($el[0]),
7522
+ 'min-height': Css_js.getElementHeight($el[0]),
7534
7523
  'padding-left': paddingL,
7535
7524
  'padding-right': paddingR,
7536
7525
  'padding-top': paddingT,
@@ -7618,8 +7607,8 @@ DGTable.prototype._cellMouseOverEvent = function (el) {
7618
7607
  // Handle RTL, go from the other side
7619
7608
  if (rtl) {
7620
7609
  let windowWidth = $(window).width();
7621
- offset.right = windowWidth - (offset.left + Css.getElementWidth($el[0], true, true, true));
7622
- parentOffset.right = windowWidth - (parentOffset.left + Css.getElementWidth($parent[0], true, true, true));
7610
+ offset.right = windowWidth - (offset.left + Css_js.getElementWidth($el[0], true, true, true));
7611
+ parentOffset.right = windowWidth - (parentOffset.left + Css_js.getElementWidth($parent[0], true, true, true));
7623
7612
  }
7624
7613
 
7625
7614
  // If the parent has borders, then it would offset the offset...
@@ -7638,14 +7627,14 @@ DGTable.prototype._cellMouseOverEvent = function (el) {
7638
7627
 
7639
7628
  // Constrain horizontally
7640
7629
  let minHorz = 0,
7641
- maxHorz = $parent - Css.getElementWidth($previewCell[0], true, true, true);
7630
+ maxHorz = $parent - Css_js.getElementWidth($previewCell[0], true, true, true);
7642
7631
  offset[prop] = offset[prop] < minHorz ?
7643
7632
  minHorz :
7644
7633
  offset[prop] > maxHorz ? maxHorz : offset[prop];
7645
7634
 
7646
7635
  // Constrain vertically
7647
- let totalHeight = Css.getElementHeight($el[0], true, true, true);
7648
- let maxTop = $scrollParent.scrollTop() + Css.getElementHeight($parent[0], true) - totalHeight;
7636
+ let totalHeight = Css_js.getElementHeight($el[0], true, true, true);
7637
+ let maxTop = $scrollParent.scrollTop() + Css_js.getElementHeight($parent[0], true) - totalHeight;
7649
7638
  if (offset.top > maxTop) {
7650
7639
  offset.top = Math.max(0, maxTop);
7651
7640
  }