canvas-datagrid 0.3.25 → 0.4.3

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.
@@ -1153,8 +1153,131 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
1153
1153
  });
1154
1154
  }
1155
1155
  }
1156
+ /**
1157
+ * Return a tuple if the user selected contiguous columns, otherwise `null`.
1158
+ * Info: Because the user may reorder the columns,
1159
+ * the schemaIndex of the first item may be greater than the schemaIndex of the second item,
1160
+ * but the columnIndex of the firs item must less than the columnIndex of the second item.
1161
+ * @param {any[]} schema from `self.getSchema()`
1162
+ * @returns {any[]} column schemas tuple (each schema has an additional field `schemaIndex`)
1163
+ */
1164
+
1165
+
1166
+ function getSelectedContiguousColumns(ev, schema) {
1167
+ var memoKey = '__contiguousColumns';
1168
+ if (Array.isArray(ev[memoKey]) || ev[memoKey] === null) return ev[memoKey];
1169
+ ev[memoKey] = null;
1170
+ if (!Array.isArray(self.selections) || self.selections.length === 0) return;
1171
+ var selection = self.selections[0];
1172
+ if (!selection || selection.length === 0) return;
1173
+
1174
+ for (var rowIndex = 0; rowIndex < self.viewData.length; rowIndex++) {
1175
+ var row = self.viewData[rowIndex];
1176
+ if (!row) continue;
1177
+ var compare = self.selections[rowIndex];
1178
+ if (!compare) return;
1179
+ if (compare.length !== selection.length) return;
1180
+
1181
+ for (var i = 0; i < selection.length; i++) {
1182
+ if (selection[i] !== compare[i]) return;
1183
+ }
1184
+ }
1185
+
1186
+ selection.sort(function (a, b) {
1187
+ return a - b;
1188
+ });
1189
+ /** @type {number[][]} */
1190
+
1191
+ var ranges = [];
1192
+ var begin = selection[0];
1193
+ var end = selection[0];
1194
+
1195
+ for (var _i = 1; _i < selection.length; _i++) {
1196
+ var orderIndex = selection[_i];
1197
+
1198
+ if (orderIndex === end + 1) {
1199
+ end = orderIndex;
1200
+ continue;
1201
+ }
1202
+
1203
+ ranges.push([begin, end]);
1204
+ begin = orderIndex;
1205
+ end = orderIndex;
1206
+ }
1207
+
1208
+ ranges.push([begin, end]);
1209
+ var currentOrderIndex = ev.cell.columnIndex;
1210
+ var matchedRange = ranges.find(function (range) {
1211
+ return currentOrderIndex >= range[0] && currentOrderIndex <= range[1] && range[0] !== range[1];
1212
+ });
1213
+ if (!matchedRange) return;
1214
+ /** @type {number[]} orders[index] => columnIndex */
1215
+
1216
+ var orders = self.orders.columns;
1217
+ if (!Array.isArray(orders)) return;
1218
+ var matchedSchema = matchedRange.map(function (orderIndex) {
1219
+ var schemaIndex = orders[orderIndex];
1220
+ var thisSchema = schema[schemaIndex];
1221
+ return Object.assign({}, thisSchema, {
1222
+ orderIndex: orderIndex
1223
+ });
1224
+ });
1225
+ if (matchedSchema.findIndex(function (it) {
1226
+ return !it;
1227
+ }) >= 0) return;
1228
+ return ev[memoKey] = matchedSchema;
1229
+ }
1230
+ /**
1231
+ * @param {boolean} [allowOnlyOneRow]
1232
+ * @returns {number[]} a rowIndex tuple. It can contains one row index or two row indexes.
1233
+ */
1234
+
1235
+
1236
+ function getSelectedContiguousRows(allowOnlyOneRow) {
1237
+ var range = [];
1238
+ var prev = -2;
1239
+ var ok = true;
1240
+ self.selections.forEach(function (row, index) {
1241
+ if (!ok) return;
1242
+
1243
+ if (prev < -1) {
1244
+ prev = index;
1245
+ range[0] = index;
1246
+ return;
1247
+ }
1248
+
1249
+ if (index !== prev + 1 || !row || row.length === 0) {
1250
+ ok = false;
1251
+ return;
1252
+ }
1253
+
1254
+ prev = index;
1255
+ range[1] = index;
1256
+ });
1257
+
1258
+ if (ok) {
1259
+ if (range.length === 1) return allowOnlyOneRow ? range : null;
1260
+ return range;
1261
+ }
1262
+ }
1156
1263
 
1157
1264
  function addDefaultContextMenuItem(e) {
1265
+ var schema = self.getSchema();
1266
+ /**
1267
+ * A map between columnIndex and column data
1268
+ * @type {Map<string,any>}
1269
+ */
1270
+
1271
+ var columns;
1272
+
1273
+ var getColumnsMap = function getColumnsMap() {
1274
+ if (!columns) columns = new Map(schema.map(function (_col) {
1275
+ return [_col.columnIndex, _col];
1276
+ }));
1277
+ return columns;
1278
+ };
1279
+
1280
+ var isSorting = self.orderings.columns && self.orderings.columns.length > 0;
1158
1281
  var isNormalCell = !(e.cell.isBackground || e.cell.isColumnHeaderCellCap || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader) && e.cell.header;
1159
1282
 
1160
1283
  if (self.attributes.showFilter && isNormalCell) {
@@ -1217,17 +1340,34 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
1217
1340
  });
1218
1341
 
1219
1342
  if (e.cell && e.cell.header && e.cell.columnIndex > -1) {
1343
+ // This variable represents the order index because of the following codes from `draw.js`:
1344
+ // columnIndex: columnOrderIndex,
1345
+ var columnOrderIndex = e.cell.columnIndex;
1346
+ var columnIndex = self.orders.columns[columnOrderIndex];
1347
+ var contiguousColumns = getSelectedContiguousColumns(e, schema);
1348
+ var title = '';
1349
+
1350
+ if (contiguousColumns) {
1351
+ title = contiguousColumns.map(function (col) {
1352
+ return col.title || col.name;
1353
+ }).join('-');
1354
+ } else {
1355
+ var column = schema[columnIndex];
1356
+ if (column) title = column.title || column.name;
1357
+ }
1358
+
1220
1359
  e.items.push({
1221
- title: self.attributes.hideColumnText.replace(/%s/gi, e.cell.header.title || e.cell.header.name),
1360
+ title: self.attributes.hideColumnText.replace(/%s/gi, title),
1222
1361
  click: function click(ev) {
1223
- self.getSchema()[e.cell.columnIndex].hidden = true;
1224
1362
  ev.preventDefault();
1225
1363
  self.stopPropagation(ev);
1226
1364
  self.disposeContextMenu();
1227
- self.setStorageData();
1228
- setTimeout(function () {
1229
- self.resize(true);
1230
- }, 10);
1365
+
1366
+ if (contiguousColumns) {
1367
+ self.hideColumns(contiguousColumns[0].orderIndex, contiguousColumns[1].orderIndex);
1368
+ } else {
1369
+ self.hideColumns(columnOrderIndex);
1370
+ }
1231
1371
  }
1232
1372
  });
1233
1373
  }
@@ -1275,7 +1415,258 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
1275
1415
  self.controlInput.focus();
1276
1416
  }
1277
1417
  });
1418
+ } //#region hide rows
1419
+
1420
+
1421
+ var canHideRows = !isSorting && e.cell.isRowHeader && e.cell.header;
1422
+
1423
+ if (canHideRows) {
1424
+ var range = getSelectedContiguousRows(true);
1425
+
1426
+ if (range) {
1427
+ var boundRowIndexes = range.map(function (viewRowIndex) {
1428
+ return self.getBoundRowIndexFromViewRowIndex(viewRowIndex);
1429
+ });
1430
+
1431
+ var _title;
1432
+
1433
+ if (boundRowIndexes.length === 1) {
1434
+ if (typeof boundRowIndexes[0] === 'number') _title = boundRowIndexes[0] + 1;else _title = range[0] + 1;
1435
+ _title = self.attributes.showHideRow.replace('%s', _title); // hide one row
1436
+
1437
+ e.items.push({
1438
+ title: _title,
1439
+ click: function click(ev) {
1440
+ ev.preventDefault();
1441
+ self.hideRows(boundRowIndexes[0], boundRowIndexes[0]);
1442
+ }
1443
+ });
1444
+ } else if (boundRowIndexes[0] <= boundRowIndexes[1]) {
1445
+ _title = boundRowIndexes.map(function (it, index) {
1446
+ if (typeof it === 'number') return it + 1;
1447
+ return range[index] + 1;
1448
+ }).join('-');
1449
+ _title = self.attributes.showHideRows.replace('%s', _title); // hide rows
1450
+
1451
+ e.items.push({
1452
+ title: _title,
1453
+ click: function click(ev) {
1454
+ ev.preventDefault();
1455
+ self.hideRows(boundRowIndexes[0], boundRowIndexes[1]);
1456
+ }
1457
+ });
1458
+ }
1459
+ }
1460
+ } //#endregion hide rows
1461
+ //#region group/ungroup columns
1462
+
1463
+
1464
+ var groupAreaHeight = self.getColumnGroupAreaHeight();
1465
+ var groupAreaWidth = self.getRowGroupAreaWidth();
1466
+
1467
+ var setCollapseStateForAllGroups = function setCollapseStateForAllGroups(allGroups, collapsed) {
1468
+ if (allGroups.length === 0) return;
1469
+
1470
+ for (var i = 0; i < allGroups.length; i++) {
1471
+ var groups = allGroups[i];
1472
+
1473
+ for (var j = 0; j < groups.length; j++) {
1474
+ var group = groups[j];
1475
+ group.collapsed = collapsed;
1476
+ }
1477
+ }
1478
+
1479
+ self.refresh();
1480
+ };
1481
+
1482
+ if (e.pos && e.pos.y < groupAreaHeight) {
1483
+ e.items.push({
1484
+ title: self.attributes.showRemoveAllGroupColumns,
1485
+ click: function click(ev) {
1486
+ ev.preventDefault();
1487
+ self.groupedColumns = [];
1488
+ self.refresh();
1489
+ }
1490
+ });
1491
+ e.items.push({
1492
+ title: self.attributes.showExpandAllGroupColumns,
1493
+ click: function click(ev) {
1494
+ ev.preventDefault();
1495
+ setCollapseStateForAllGroups(self.groupedColumns, false);
1496
+ }
1497
+ });
1498
+ e.items.push({
1499
+ title: self.attributes.showCollapseAllGroupColumns,
1500
+ click: function click(ev) {
1501
+ ev.preventDefault();
1502
+ setCollapseStateForAllGroups(self.groupedColumns, true);
1503
+ }
1504
+ });
1505
+ }
1506
+
1507
+ if (e.pos && e.pos.x < groupAreaWidth) {
1508
+ e.items.push({
1509
+ title: self.attributes.showRemoveAllGroupRows,
1510
+ click: function click(ev) {
1511
+ ev.preventDefault();
1512
+ self.groupedRows = [];
1513
+ self.refresh();
1514
+ }
1515
+ });
1516
+ e.items.push({
1517
+ title: self.attributes.showExpandAllGroupRows,
1518
+ click: function click(ev) {
1519
+ ev.preventDefault();
1520
+ setCollapseStateForAllGroups(self.groupedRows, false);
1521
+ }
1522
+ });
1523
+ e.items.push({
1524
+ title: self.attributes.showCollapseAllGroupRows,
1525
+ click: function click(ev) {
1526
+ ev.preventDefault();
1527
+ setCollapseStateForAllGroups(self.groupedRows, true);
1528
+ }
1529
+ });
1530
+ }
1531
+
1532
+ var canGroupByColumns = self.attributes.allowGroupingColumns && e.cell.isColumnHeader && e.cell.header && e.cell.header.index > 0;
1533
+ var canUngroupColumns = self.attributes.allowGroupingColumns && e.cell.isColumnHeader;
1534
+ var canGroupByRows = !isSorting && self.attributes.allowGroupingRows && e.cell.isRowHeader && e.cell.header;
1535
+ var canUngroupRows = self.attributes.allowGroupingRows && e.cell.isRowHeader;
1536
+
1537
+ if (canGroupByColumns) {
1538
+ /** @type {number[]} */
1539
+ var groupIndexes = [];
1540
+ /** @type {number} */
1541
+
1542
+ var headerIndex = e.cell.header.index;
1543
+ var col = headerIndex;
1544
+
1545
+ for (; col >= 0; col--) {
1546
+ if (!self.isColumnSelected(col)) break;
1547
+ groupIndexes[0] = col;
1548
+ }
1549
+
1550
+ for (col = headerIndex;; col++) {
1551
+ if (!self.isColumnSelected(col)) break;
1552
+ groupIndexes[1] = col;
1553
+ }
1554
+
1555
+ if (col !== headerIndex && groupIndexes.length === 2 && groupIndexes[1] > groupIndexes[0] && self.isNewGroupRangeValid(self.groupedColumns, groupIndexes[0], groupIndexes[1])) {
1556
+ var _columns = getColumnsMap();
1557
+
1558
+ var groupTitles = [];
1559
+ var groupNames = [];
1560
+
1561
+ for (var i = 0; i < groupIndexes.length; i++) {
1562
+ var _columnIndex = groupIndexes[i];
1563
+
1564
+ var _column = _columns.get(_columnIndex);
1565
+
1566
+ if (_column) {
1567
+ groupNames.push(_column.name);
1568
+ groupTitles.push(_column.title || _column.name || _column.index);
1569
+ }
1570
+ }
1571
+
1572
+ if (groupNames[0] && groupNames[1]) {
1573
+ // show group options
1574
+ e.items.push({
1575
+ title: self.attributes.showGroupColumns.replace('%s', groupTitles[0] + '-' + groupTitles[1]),
1576
+ click: function click(ev) {
1577
+ ev.preventDefault();
1578
+ self.groupColumns(groupNames[0], groupNames[1]);
1579
+ self.controlInput.focus();
1580
+ }
1581
+ });
1582
+ }
1583
+ }
1584
+ }
1585
+
1586
+ if (canUngroupColumns) {
1587
+ var _columnIndex2 = e.cell.columnIndex;
1588
+ var groups = self.getGroupsColumnBelongsTo(_columnIndex2);
1589
+
1590
+ var _columns2 = getColumnsMap();
1591
+
1592
+ var _loop = function _loop(_i2) {
1593
+ var _groups$_i = groups[_i2],
1594
+ from = _groups$_i.from,
1595
+ to = _groups$_i.to;
1596
+
1597
+ var cell0 = _columns2.get(from);
1598
+
1599
+ var cell1 = _columns2.get(to);
1600
+
1601
+ if (cell0 && cell1) {
1602
+ var formatArgs = (cell0.title || cell0.name || cell0.index) + '-' + (cell1.title || cell1.name || cell1.index);
1603
+ e.items.push({
1604
+ title: self.attributes.showRemoveGroupColumns.replace('%s', formatArgs),
1605
+ click: function click(ev) {
1606
+ ev.preventDefault();
1607
+ self.removeGroupColumns(cell0.name, cell1.name);
1608
+ self.controlInput.focus();
1609
+ }
1610
+ });
1611
+ } else {
1612
+ console.warn("Cannot find column ".concat(from, " or column ").concat(to));
1613
+ }
1614
+ };
1615
+
1616
+ for (var _i2 = 0; _i2 < groups.length; _i2++) {
1617
+ _loop(_i2);
1618
+ }
1619
+ }
1620
+
1621
+ if (canGroupByRows) {
1622
+ var _range = getSelectedContiguousRows(false) || [];
1623
+
1624
+ var rangeTitle = _range.map(function (rowIndex) {
1625
+ var index = self.getBoundRowIndexFromViewRowIndex(rowIndex);
1626
+ if (typeof index === 'number') return index + 1;
1627
+ return rowIndex + 1;
1628
+ }).join('-');
1629
+
1630
+ if (_range.length === 2 && self.isNewGroupRangeValid(self.groupedRows, _range[0], _range[1])) {
1631
+ e.items.push({
1632
+ title: self.attributes.showGroupRows.replace('%s', rangeTitle),
1633
+ click: function click(ev) {
1634
+ ev.preventDefault();
1635
+ self.groupRows(_range[0], _range[1]);
1636
+ }
1637
+ });
1638
+ }
1278
1639
  }
1640
+
1641
+ if (canUngroupRows) {
1642
+ var rowIndex = e.cell.rowIndex;
1643
+
1644
+ var _groups = self.getGroupsRowBelongsTo(rowIndex);
1645
+
1646
+ var _loop2 = function _loop2(_i3) {
1647
+ var _groups$_i2 = _groups[_i3],
1648
+ from = _groups$_i2.from,
1649
+ to = _groups$_i2.to;
1650
+ var rangeTitle = [from, to].map(function (rowIndex) {
1651
+ var index = self.getBoundRowIndexFromViewRowIndex(rowIndex);
1652
+ if (typeof index === 'number') return index + 1;
1653
+ return rowIndex + 1;
1654
+ }).join('-');
1655
+ e.items.push({
1656
+ title: self.attributes.showRemoveGroupRows.replace('%s', rangeTitle),
1657
+ click: function click(ev) {
1658
+ ev.preventDefault();
1659
+ self.removeGroupRows(from, to);
1660
+ self.controlInput.focus();
1661
+ }
1662
+ });
1663
+ };
1664
+
1665
+ for (var _i3 = 0; _i3 < _groups.length; _i3++) {
1666
+ _loop2(_i3);
1667
+ }
1668
+ } //#endregion group/ungroup columns
1669
+
1279
1670
  }
1280
1671
 
1281
1672
  self.disposeAutocomplete = function () {
@@ -1306,6 +1697,59 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
1306
1697
  self.contextmenuEvent = function (e, overridePos) {
1307
1698
  if (!self.hasFocus && e.target !== self.canvas) {
1308
1699
  return;
1700
+ } // don't create context menu for parents if current position is located in child grid
1701
+
1702
+
1703
+ var children = Object.keys(self.childGrids);
1704
+
1705
+ for (var i = 0; i < children.length; i++) {
1706
+ var childGrid = self.childGrids[children[i]];
1707
+ var parentNode = childGrid && childGrid.parentNode;
1708
+ if (!parentNode) continue;
1709
+ var offsetLeft = parentNode.offsetLeft,
1710
+ offsetWidth = parentNode.offsetWidth,
1711
+ offsetTop = parentNode.offsetTop,
1712
+ offsetHeight = parentNode.offsetHeight;
1713
+ if ((e.x >= offsetLeft && e.x <= offsetLeft + offsetWidth) === false) continue;
1714
+ if ((e.y >= offsetTop && e.y <= offsetTop + offsetHeight) === false) continue;
1715
+ return; // in child grid
1716
+ } // don't create context menu for child if current position is located in parent grid
1717
+
1718
+
1719
+ if (self.isChildGrid && self.parentNode) {
1720
+ //#region check is current child grid closed
1721
+ var childGridsOfParent = self.parentGrid && self.parentGrid.childGrids;
1722
+ if (!childGridsOfParent || !Array.isArray(childGridsOfParent)) return;
1723
+ var matchedMe = childGridsOfParent.find(function (grid) {
1724
+ var nodeA = grid.parentNode;
1725
+ var nodeB = self.parentNode;
1726
+ return nodeA.offsetTop == nodeB.offsetTop && nodeA.offsetLeft === nodeB.offsetLeft;
1727
+ });
1728
+ if (!matchedMe) return; //#endregion
1729
+
1730
+ var x0 = self.parentNode.offsetLeft;
1731
+ var x1 = self.parentNode.offsetLeft + self.parentNode.offsetWidth;
1732
+ var y0 = self.parentNode.offsetTop;
1733
+ var y1 = self.parentNode.offsetTop + self.parentNode.offsetHeight;
1734
+ var node = self.parentNode.parentNode;
1735
+
1736
+ while (node) {
1737
+ var _node = node,
1738
+ _offsetLeft = _node.offsetLeft,
1739
+ _offsetWidth = _node.offsetWidth,
1740
+ _offsetTop = _node.offsetTop,
1741
+ _offsetHeight = _node.offsetHeight;
1742
+ if (_offsetLeft > x0) x0 = _offsetLeft;
1743
+ if (_offsetTop > y0) y0 = _offsetTop;
1744
+ var newX1 = _offsetLeft + _offsetWidth;
1745
+ var newY1 = _offsetTop + _offsetHeight;
1746
+ if (newX1 < x1) x1 = newX1;
1747
+ if (newY1 < y1) y1 = newY1;
1748
+ if (node.nodeType !== 'canvas-datagrid-tree') break;
1749
+ node = node.parentNode;
1750
+ }
1751
+
1752
+ if ((e.x >= x0 && e.x <= x1 && e.y >= y0 && e.y <= y1) === false) return;
1309
1753
  }
1310
1754
 
1311
1755
  function createDisposeEvent() {
@@ -1321,6 +1765,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
1321
1765
  ev = {
1322
1766
  NativeEvent: e,
1323
1767
  cell: self.getCellAt(pos.x, pos.y),
1768
+ pos: pos,
1324
1769
  items: items
1325
1770
  };
1326
1771
 
@@ -1394,8 +1839,10 @@ __webpack_require__.r(__webpack_exports__);
1394
1839
 
1395
1840
  /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
1396
1841
  self.defaults = {
1397
- attributes: [['allowColumnReordering', true], ['allowColumnResize', true], ['allowColumnResizeFromCell', false], ['allowFreezingRows', false], ['allowFreezingColumns', false], ['allowMovingSelection', true], ['allowRowHeaderResize', true], ['allowRowReordering', false], ['allowRowResize', true], ['allowRowResizeFromCell', false], ['allowSorting', true], ['animationDurationShowContextMenu', 50], ['animationDurationHideContextMenu', 50], ['autoGenerateSchema', false], ['autoResizeColumns', false], ['autoResizeRows', false], ['autoScrollOnMousemove', false], ['autoScrollMargin', 5], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', '&nbsp;&nbsp;&nbsp;'], ['columnSelectorText', 'Add/Remove columns'], ['columnSelectorVisibleText', "\u2713"], ['contextHoverScrollAmount', 2], ['contextHoverScrollRateMs', 5], ['copyHeadersOnSelectAll', true], ['copyText', 'Copy'], ['debug', false], ['editable', true], ['ellipsisText', '...'], ['filterOptionText', 'Filter %s'], ['filterTextPrefix', '(filtered) '], ['filterFrozenRows', true], ['globalRowResize', false], ['hideColumnText', 'Hide %s'], ['hoverMode', 'cell'], ['keepFocusOnMouseOut', false], ['maxAutoCompleteItems', 200], ['multiLine', false], ['name', ''], ['pageUpDownOverlap', 1], ['pasteText', 'Paste'], ['persistantSelectionMode', false], ['removeFilterOptionText', 'Remove filter on %s'], ['reorderDeadZone', 3], ['resizeScrollZone', 20], ['rowGrabZoneSize', 5], ['saveAppearance', true], ['scrollAnimationPPSThreshold', 0.75], ['scrollPointerLock', false], ['scrollRepeatRate', 75], ['selectionFollowsActiveCell', false], ['selectionHandleBehavior', 'none'], ['selectionMode', 'cell'], ['selectionScrollIncrement', 20], ['selectionScrollZone', 20], ['showClearSettingsOption', true], ['showColumnHeaders', true], ['showColumnSelector', true], ['showCopy', false], ['showFilter', true], ['showFilterInCell', false], ['showNewRow', false], ['showOrderByOption', true], ['showOrderByOptionTextAsc', 'Order by %s ascending'], ['showOrderByOptionTextDesc', 'Order by %s descending'], ['showPaste', false], ['showPerformance', false], ['showRowHeaders', true], ['showRowNumbers', true], ['showRowNumberGaps', true], ['singleSelectionMode', false], ['snapToRow', false], ['sortFrozenRows', true], ['touchContextMenuTimeMs', 800], ['touchDeadZone', 3], ['touchEasingMethod', 'easeOutQuad'], ['touchReleaseAcceleration', 1000], ['touchReleaseAnimationDurationMs', 2000], ['touchScrollZone', 20], ['touchSelectHandleZone', 20], ['touchZoomSensitivity', 0.005], ['touchZoomMin', 0.5], ['touchZoomMax', 1.75], ['maxPixelRatio', 2], ['tree', false], ['treeHorizontalScroll', false]],
1398
- styles: [['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'], ['activeCellBorderWidth', 1], ['activeCellColor', 'rgba(0, 0, 0, 1)'], ['activeCellFont', '16px sans-serif'], ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellHorizontalAlignment', 'left'], ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'], ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['activeCellOverlayBorderWidth', 1], ['activeCellPaddingBottom', 5], ['activeCellPaddingLeft', 5], ['activeCellPaddingRight', 5], ['activeCellPaddingTop', 5], ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'], ['activeCellVerticalAlignment', 'center'], ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['autocompleteBottomMargin', 60], ['autosizeHeaderCellPadding', 8], ['autosizePadding', 5], ['buttonActiveBackgroundColor', 'rgba(255, 255, 255, 1)'], ['buttonActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['buttonArrowColor', 'rgba(50, 50, 50, 1)'], ['buttonArrowDownHTML', '&#x25BC;'], ['buttonZIndex', 10000], ['buttonBackgroundColor', 'rgba(255, 255, 255, 1)'], ['buttonBorderColor', 'rgba(172, 172, 172, 1)'], ['buttonHoverBackgroundColor', 'rgba(240, 240, 240, 1)'], ['buttonMenuWindowMargin', 30], ['buttonPadding', '3px'], ['cellAutoResizePadding', 13], ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellBorderColor', 'rgba(195, 199, 202, 1)'], ['cellBorderWidth', 1], ['cellColor', 'rgba(0, 0, 0, 1)'], ['cellFont', '16px sans-serif'], ['cellGridHeight', 250], ['cellHeight', 24], ['cellHeightWithChildGrid', 150], ['cellHorizontalAlignment', 'left'], ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellHoverColor', 'rgba(0, 0, 0, 1)'], ['cellPaddingBottom', 5], ['cellPaddingLeft', 5], ['cellPaddingRight', 5], ['cellPaddingTop', 5], ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['cellSelectedColor', 'rgba(0, 0, 0, 1)'], ['cellVerticalAlignment', 'center'], ['cellWidth', 250], ['cellWidthWithChildGrid', 250], ['cellWhiteSpace', 'nowrap'], ['cellLineHeight', 1], ['cellLineSpacing', 3], ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['childContextMenuArrowHTML', '&#x25BA;'], ['childContextMenuMarginLeft', -11], ['childContextMenuMarginTop', -6], ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellBorderWidth', 1], ['columnHeaderCellCapBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellCapBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellCapBorderWidth', 1], ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['columnHeaderCellFont', '16px sans-serif'], ['columnHeaderCellHeight', 25], ['columnHeaderCellHorizontalAlignment', 'left'], ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['columnHeaderCellPaddingBottom', 5], ['columnHeaderCellPaddingLeft', 5], ['columnHeaderCellPaddingRight', 5], ['columnHeaderCellPaddingTop', 5], ['columnHeaderCellVerticalAlignment', 'center'], ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['columnHeaderOrderByArrowBorderWidth', 1], ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'], ['columnHeaderOrderByArrowHeight', 8], ['columnHeaderOrderByArrowMarginLeft', 0], ['columnHeaderOrderByArrowMarginRight', 5], ['columnHeaderOrderByArrowMarginTop', 6], ['columnHeaderOrderByArrowWidth', 13], ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterButtonBorderRadius', '3px'], ['contextFilterButtonHTML', '&#x25BC;'], ['contextFilterInputBackground', 'rgba(255,255,255,1)'], ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterInputBorderRadius', '0'], ['contextFilterInputColor', 'rgba(0,0,0,1)'], ['contextFilterInputFontFamily', 'sans-serif'], ['contextFilterInputFontSize', '14px'], ['contextFilterInvalidRegExpBackground', 'rgba(180, 6, 1, 1)'], ['contextFilterInvalidRegExpColor', 'rgba(255, 255, 255, 1)'], ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['contextMenuArrowDownHTML', '&#x25BC;'], ['contextMenuArrowUpHTML', '&#x25B2;'], ['contextMenuBackground', 'rgba(240, 240, 240, 1)'], ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextMenuBorderRadius', '3px'], ['contextMenuChildArrowFontSize', '12px'], ['contextMenuColor', 'rgba(43, 48, 43, 1)'], ['contextMenuCursor', 'default'], ['contextMenuFilterButtonFontFamily', 'sans-serif'], ['contextMenuFilterButtonFontSize', '10px'], ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'], ['contextMenuFontFamily', 'sans-serif'], ['contextMenuFontSize', '16px'], ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'], ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'], ['contextMenuItemBorderRadius', '3px'], ['contextMenuItemMargin', '2px'], ['contextMenuLabelDisplay', 'inline-block'], ['contextMenuLabelMargin', '0 3px 0 0'], ['contextMenuLabelMaxWidth', '700px'], ['contextMenuLabelMinWidth', '75px'], ['contextMenuMarginLeft', 3], ['contextMenuMarginTop', -3], ['contextMenuOpacity', '0.98'], ['contextMenuPadding', '2px'], ['contextMenuWindowMargin', 30], ['contextMenuZIndex', 10000], ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'], ['debugBackgroundColor', 'rgba(0, 0, 0, .0)'], ['debugColor', 'rgba(255, 15, 24, 1)'], ['debugEntitiesColor', 'rgba(76, 231, 239, 1.00)'], ['debugFont', '11px sans-serif'], ['debugPerfChartBackground', 'rgba(29, 25, 26, 1.00)'], ['debugPerfChartTextColor', 'rgba(255, 255, 255, 0.8)'], ['debugPerformanceColor', 'rgba(252, 255, 37, 1.00)'], ['debugScrollHeightColor', 'rgba(248, 33, 103, 1.00)'], ['debugScrollWidthColor', 'rgba(66, 255, 27, 1.00)'], ['debugTouchPPSXColor', 'rgba(246, 102, 24, 1.00)'], ['debugTouchPPSYColor', 'rgba(186, 0, 255, 1.00)'], ['display', 'inline-block'], ['editCellBackgroundColor', 'white'], ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'], ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'], ['editCellColor', 'black'], ['editCellFontFamily', 'sans-serif'], ['editCellFontSize', '16px'], ['editCellPaddingLeft', 4], ['editCellZIndex', 10000], ['filterButtonActiveBackgroundColor', 'rgba(225, 225, 225, 1)'], ['filterButtonArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['filterButtonArrowBorderWidth', 1], ['filterButtonArrowClickRadius', 5], ['filterButtonArrowColor', 'rgba(50, 50, 50, 1)'], ['filterButtonArrowHeight', 5], ['filterButtonArrowWidth', 8], ['filterButtonBackgroundColor', 'rgba(240, 240, 240, 1)'], ['filterButtonBorderColor', 'rgba(172, 172, 172, 1)'], ['filterButtonBorderRadius', 3], ['filterButtonHeight', 20], ['filterButtonHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['filterButtonMenuOffsetTop', 10], ['filterButtonWidth', 20], ['frozenMarkerHoverColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerHoverBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerActiveColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerColor', 'rgba(222, 222, 222, 1)'], ['frozenMarkerBorderColor', 'rgba(168, 168, 168, 1)'], ['frozenMarkerBorderWidth', 1], ['frozenMarkerWidth', 2], ['gridBackgroundColor', 'rgba(240, 240, 240, 1)'], ['gridBorderCollapse', 'collapse'], ['gridBorderColor', 'rgba(202, 202, 202, 1)'], ['gridBorderWidth', 1], ['height', 'auto'], ['maxHeight', 'inherit'], ['maxWidth', 'inherit'], ['minColumnWidth', 45], ['minHeight', 'inherit'], ['minRowHeight', 24], ['minWidth', 'inherit'], ['mobileContextMenuMargin', 10], ['mobileEditInputHeight', 30], ['mobileEditFontFamily', 'sans-serif'], ['mobileEditFontSize', '16px'], ['moveOverlayBorderWidth', 1], ['moveOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['moveOverlayBorderSegments', '12, 7'], ['name', 'default'], ['overflowY', 'auto'], ['overflowX', 'auto'], ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'], ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'], ['reorderMarkerBorderWidth', 1.25], ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'], ['reorderMarkerIndexBorderWidth', 2.75], ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'], ['rowHeaderCellBorderWidth', 1], ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellFont', '16px sans-serif'], ['rowHeaderCellHeight', 25], ['rowHeaderCellHorizontalAlignment', 'left'], ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['rowHeaderCellPaddingBottom', 5], ['rowHeaderCellPaddingLeft', 5], ['rowHeaderCellPaddingRight', 5], ['rowHeaderCellPaddingTop', 5], ['rowHeaderCellRowNumberGapHeight', 5], ['rowHeaderCellRowNumberGapColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'], ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellVerticalAlignment', 'center'], ['rowHeaderCellWidth', 57], ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'], ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarBorderWidth', 0.5], ['scrollBarBoxBorderRadius', 4.125], ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'], ['scrollBarBoxMargin', 2], ['scrollBarBoxMinSize', 15], ['scrollBarBoxWidth', 8], ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarWidth', 11], ['selectionHandleBorderColor', 'rgba(255, 255, 255, 1)'], ['selectionHandleBorderWidth', 1.5], ['selectionHandleColor', 'rgba(66, 133, 244, 1)'], ['selectionHandleSize', 8], ['selectionHandleType', 'square'], ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['selectionOverlayBorderWidth', 1], ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['treeArrowBorderWidth', 1], ['treeArrowClickRadius', 5], ['treeArrowColor', 'rgba(155, 155, 155, 1)'], ['treeArrowHeight', 8], ['treeArrowMarginLeft', 0], ['treeArrowMarginRight', 5], ['treeArrowMarginTop', 6], ['treeArrowWidth', 13], ['treeGridHeight', 250], ['width', 'auto']]
1842
+ attributes: [['allowColumnReordering', true], ['allowColumnResize', true], ['allowColumnResizeFromCell', false], ['allowFreezingRows', false], ['allowFreezingColumns', false], ['allowMovingSelection', true], ['allowRowHeaderResize', true], ['allowRowReordering', false], ['allowRowResize', true], ['allowRowResizeFromCell', false], ['allowSorting', true], ['allowGroupingRows', true], ['allowGroupingColumns', true], ['animationDurationShowContextMenu', 50], ['animationDurationHideContextMenu', 50], ['autoGenerateSchema', false], ['autoResizeColumns', false], ['autoResizeRows', false], ['autoScrollOnMousemove', false], ['autoScrollMargin', 5], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', '&nbsp;&nbsp;&nbsp;'], ['columnSelectorText', 'Add/Remove columns'], ['columnSelectorVisibleText', "\u2713"], ['contextHoverScrollAmount', 2], ['contextHoverScrollRateMs', 5], ['copyHeadersOnSelectAll', true], ['copyText', 'Copy'], ['debug', false], ['editable', true], ['ellipsisText', '...'], ['filterOptionText', 'Filter %s'], ['filterTextPrefix', '(filtered) '], ['filterFrozenRows', true], ['globalRowResize', false], ['hideColumnText', 'Hide %s'], ['showUnhideColumnsIndicator', false], ['showUnhideRowsIndicator', false], ['showHideRow', 'Hide row %s'], ['showHideRows', 'Hide rows %s'], ['hoverMode', 'cell'], ['keepFocusOnMouseOut', false], ['maxAutoCompleteItems', 200], ['multiLine', false], ['name', ''], ['pageUpDownOverlap', 1], ['pasteText', 'Paste'], ['persistantSelectionMode', false], ['removeFilterOptionText', 'Remove filter on %s'], ['reorderDeadZone', 3], ['resizeScrollZone', 20], ['rowGrabZoneSize', 5], ['columnGrabZoneSize', 30], ['saveAppearance', true], ['scrollAnimationPPSThreshold', 0.75], ['scrollPointerLock', false], ['scrollRepeatRate', 75], ['selectionFollowsActiveCell', false], ['selectionHandleBehavior', 'none'], ['selectionMode', 'cell'], ['selectionScrollIncrement', 20], ['selectionScrollZone', 20], ['showClearSettingsOption', true], ['showColumnHeaders', true], ['showColumnSelector', true], ['showCopy', false], ['showFilter', true], ['showFilterInCell', false], ['showNewRow', false], ['showOrderByOption', true], ['showOrderByOptionTextAsc', 'Order by %s ascending'], ['showOrderByOptionTextDesc', 'Order by %s descending'], //#region grouping
1843
+ ['showGroupColumns', 'Group columns %s'], ['showGroupRows', 'Group rows %s'], ['showRemoveGroupColumns', 'Remove group %s'], ['showRemoveGroupRows', 'Remove group %s'], ['showRemoveAllGroupColumns', 'Remove all column groups'], ['showRemoveAllGroupRows', 'Remove all row groups'], ['showExpandAllGroupColumns', 'Expand all column groups'], ['showExpandAllGroupRows', 'Expand all row groups'], ['showCollapseAllGroupColumns', 'Collapse all column groups'], ['showCollapseAllGroupRows', 'Collapse all row groups'], ['columnGroupIndicatorPosition', 'right'], ['rowGroupIndicatorPosition', 'bottom'], //#endregion grouping
1844
+ ['showPaste', false], ['showPerformance', false], ['showRowHeaders', true], ['showRowNumbers', true], ['showRowNumberGaps', true], ['singleSelectionMode', false], ['snapToRow', false], ['sortFrozenRows', true], ['touchContextMenuTimeMs', 800], ['touchDeadZone', 3], ['touchEasingMethod', 'easeOutQuad'], ['touchReleaseAcceleration', 1000], ['touchReleaseAnimationDurationMs', 2000], ['touchScrollZone', 20], ['touchSelectHandleZone', 20], ['touchZoomSensitivity', 0.005], ['touchZoomMin', 0.5], ['touchZoomMax', 1.75], ['maxPixelRatio', 2], ['tree', false], ['treeHorizontalScroll', false], ['rowTree', []], ['rowTreeColIndex', 0], ['columnTree', []], ['columnTreeRowStartIndex', 0], ['columnTreeRowEndIndex', 0]],
1845
+ styles: [['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'], ['activeCellBorderWidth', 1], ['activeCellColor', 'rgba(0, 0, 0, 1)'], ['activeCellFont', '16px sans-serif'], ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellHorizontalAlignment', 'left'], ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'], ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['activeCellOverlayBorderWidth', 1], ['activeCellPaddingBottom', 5], ['activeCellPaddingLeft', 5], ['activeCellPaddingRight', 5], ['activeCellPaddingTop', 5], ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'], ['activeCellVerticalAlignment', 'center'], ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['autocompleteBottomMargin', 60], ['autosizeHeaderCellPadding', 8], ['autosizePadding', 5], ['buttonActiveBackgroundColor', 'rgba(255, 255, 255, 1)'], ['buttonActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['buttonArrowColor', 'rgba(50, 50, 50, 1)'], ['buttonArrowDownHTML', '&#x25BC;'], ['buttonZIndex', 10000], ['buttonBackgroundColor', 'rgba(255, 255, 255, 1)'], ['buttonBorderColor', 'rgba(172, 172, 172, 1)'], ['buttonHoverBackgroundColor', 'rgba(240, 240, 240, 1)'], ['buttonMenuWindowMargin', 30], ['buttonPadding', '3px'], ['cellAutoResizePadding', 13], ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellBorderColor', 'rgba(195, 199, 202, 1)'], ['cellBorderWidth', 1], ['cellColor', 'rgba(0, 0, 0, 1)'], ['cellFont', '16px sans-serif'], ['cellGridHeight', 250], ['cellHeight', 24], ['cellHeightWithChildGrid', 150], ['cellHorizontalAlignment', 'left'], ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellHoverColor', 'rgba(0, 0, 0, 1)'], ['cellPaddingBottom', 5], ['cellPaddingLeft', 5], ['cellPaddingRight', 5], ['cellPaddingTop', 5], ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['cellSelectedColor', 'rgba(0, 0, 0, 1)'], ['cellTreeIconBorderColor', 'rgba(162, 174, 207, 1)'], ['cellTreeIconFillColor', 'rgba(240, 240, 240, 1)'], ['cellTreeIconHoverFillColor', 'rgba(198, 217, 233, 1)'], ['cellTreeIconLineColor', 'rgba(43, 53, 81, 1)'], ['cellTreeIconLineWidth', 1.5], ['cellTreeIconMarginLeft', 0], ['cellTreeIconMarginRight', 5], ['cellTreeIconMarginTop', 6], ['cellTreeIconWidth', 13], ['cellVerticalAlignment', 'center'], ['cellWidth', 250], ['cellWidthWithChildGrid', 250], ['cellWhiteSpace', 'nowrap'], ['cellLineHeight', 1], ['cellLineSpacing', 3], ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['childContextMenuArrowHTML', '&#x25BA;'], ['childContextMenuMarginLeft', -11], ['childContextMenuMarginTop', -6], ['columnGroupRowHeight', 25], ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellBorderWidth', 1], ['columnHeaderCellCapBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellCapBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellCapBorderWidth', 1], ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['columnHeaderCellFont', '16px sans-serif'], ['columnHeaderCellHeight', 25], ['columnHeaderCellHorizontalAlignment', 'left'], ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['columnHeaderCellPaddingBottom', 5], ['columnHeaderCellPaddingLeft', 5], ['columnHeaderCellPaddingRight', 5], ['columnHeaderCellPaddingTop', 5], ['columnHeaderCellVerticalAlignment', 'center'], ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['columnHeaderOrderByArrowBorderWidth', 1], ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'], ['columnHeaderOrderByArrowHeight', 8], ['columnHeaderOrderByArrowMarginLeft', 0], ['columnHeaderOrderByArrowMarginRight', 5], ['columnHeaderOrderByArrowMarginTop', 6], ['columnHeaderOrderByArrowWidth', 13], ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterButtonBorderRadius', '3px'], ['contextFilterButtonHTML', '&#x25BC;'], ['contextFilterInputBackground', 'rgba(255,255,255,1)'], ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterInputBorderRadius', '0'], ['contextFilterInputColor', 'rgba(0,0,0,1)'], ['contextFilterInputFontFamily', 'sans-serif'], ['contextFilterInputFontSize', '14px'], ['contextFilterInvalidRegExpBackground', 'rgba(180, 6, 1, 1)'], ['contextFilterInvalidRegExpColor', 'rgba(255, 255, 255, 1)'], ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['contextMenuArrowDownHTML', '&#x25BC;'], ['contextMenuArrowUpHTML', '&#x25B2;'], ['contextMenuBackground', 'rgba(240, 240, 240, 1)'], ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextMenuBorderRadius', '3px'], ['contextMenuChildArrowFontSize', '12px'], ['contextMenuColor', 'rgba(43, 48, 43, 1)'], ['contextMenuCursor', 'default'], ['contextMenuFilterButtonFontFamily', 'sans-serif'], ['contextMenuFilterButtonFontSize', '10px'], ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'], ['contextMenuFontFamily', 'sans-serif'], ['contextMenuFontSize', '16px'], ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'], ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'], ['contextMenuItemBorderRadius', '3px'], ['contextMenuItemMargin', '2px'], ['contextMenuLabelDisplay', 'inline-block'], ['contextMenuLabelMargin', '0 3px 0 0'], ['contextMenuLabelMaxWidth', '700px'], ['contextMenuLabelMinWidth', '75px'], ['contextMenuMarginLeft', 3], ['contextMenuMarginTop', -3], ['contextMenuOpacity', '0.98'], ['contextMenuPadding', '2px'], ['contextMenuWindowMargin', 30], ['contextMenuZIndex', 10000], ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'], ['debugBackgroundColor', 'rgba(0, 0, 0, .0)'], ['debugColor', 'rgba(255, 15, 24, 1)'], ['debugEntitiesColor', 'rgba(76, 231, 239, 1.00)'], ['debugFont', '11px sans-serif'], ['debugPerfChartBackground', 'rgba(29, 25, 26, 1.00)'], ['debugPerfChartTextColor', 'rgba(255, 255, 255, 0.8)'], ['debugPerformanceColor', 'rgba(252, 255, 37, 1.00)'], ['debugScrollHeightColor', 'rgba(248, 33, 103, 1.00)'], ['debugScrollWidthColor', 'rgba(66, 255, 27, 1.00)'], ['debugTouchPPSXColor', 'rgba(246, 102, 24, 1.00)'], ['debugTouchPPSYColor', 'rgba(186, 0, 255, 1.00)'], ['display', 'inline-block'], ['editCellBackgroundColor', 'white'], ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'], ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'], ['editCellColor', 'black'], ['editCellFontFamily', 'sans-serif'], ['editCellFontSize', '16px'], ['editCellPaddingLeft', 4], ['editCellZIndex', 10000], ['filterButtonActiveBackgroundColor', 'rgba(225, 225, 225, 1)'], ['filterButtonArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['filterButtonArrowBorderWidth', 1], ['filterButtonArrowClickRadius', 5], ['filterButtonArrowColor', 'rgba(50, 50, 50, 1)'], ['filterButtonArrowHeight', 5], ['filterButtonArrowWidth', 8], ['filterButtonBackgroundColor', 'rgba(240, 240, 240, 1)'], ['filterButtonBorderColor', 'rgba(172, 172, 172, 1)'], ['filterButtonBorderRadius', 3], ['filterButtonHeight', 20], ['filterButtonHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['filterButtonMenuOffsetTop', 10], ['filterButtonWidth', 20], ['frozenMarkerHoverColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerHoverBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerActiveColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerColor', 'rgba(222, 222, 222, 1)'], ['frozenMarkerBorderColor', 'rgba(168, 168, 168, 1)'], ['frozenMarkerBorderWidth', 1], ['frozenMarkerWidth', 2], ['groupingAreaBackgroundColor', 'rgba(240, 240, 240, 1)'], ['gridBackgroundColor', 'rgba(240, 240, 240, 1)'], ['gridBorderCollapse', 'collapse'], ['gridBorderColor', 'rgba(202, 202, 202, 1)'], ['gridBorderWidth', 1], ['groupIndicatorColor', 'rgba(155, 155, 155, 1)'], ['groupIndicatorBackgroundColor', 'rgba(255, 255, 255, 1)'], ['height', 'auto'], ['maxHeight', 'inherit'], ['maxWidth', 'inherit'], ['minColumnWidth', 45], ['minHeight', 'inherit'], ['minRowHeight', 24], ['minWidth', 'inherit'], ['mobileContextMenuMargin', 10], ['mobileEditInputHeight', 30], ['mobileEditFontFamily', 'sans-serif'], ['mobileEditFontSize', '16px'], ['moveOverlayBorderWidth', 1], ['moveOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['moveOverlayBorderSegments', '12, 7'], ['name', 'default'], ['overflowY', 'auto'], ['overflowX', 'auto'], ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'], ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'], ['reorderMarkerBorderWidth', 1.25], ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'], ['reorderMarkerIndexBorderWidth', 2.75], ['rowGroupColumnWidth', 25], ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'], ['rowHeaderCellBorderWidth', 1], ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellFont', '16px sans-serif'], ['rowHeaderCellHeight', 25], ['rowHeaderCellHorizontalAlignment', 'left'], ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['rowHeaderCellPaddingBottom', 5], ['rowHeaderCellPaddingLeft', 5], ['rowHeaderCellPaddingRight', 5], ['rowHeaderCellPaddingTop', 5], ['rowHeaderCellRowNumberGapHeight', 5], ['rowHeaderCellRowNumberGapColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'], ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellVerticalAlignment', 'center'], ['rowHeaderCellWidth', 57], ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'], ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarBorderWidth', 0.5], ['scrollBarBoxBorderRadius', 4.125], ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'], ['scrollBarBoxMargin', 2], ['scrollBarBoxMinSize', 15], ['scrollBarBoxWidth', 8], ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarWidth', 11], ['selectionHandleBorderColor', 'rgba(255, 255, 255, 1)'], ['selectionHandleBorderWidth', 1.5], ['selectionHandleColor', 'rgba(66, 133, 244, 1)'], ['selectionHandleSize', 8], ['selectionHandleType', 'square'], ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['selectionOverlayBorderWidth', 1], ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['treeArrowBorderWidth', 1], ['treeArrowClickRadius', 5], ['treeArrowColor', 'rgba(155, 155, 155, 1)'], ['treeArrowHeight', 8], ['treeArrowMarginLeft', 0], ['treeArrowMarginRight', 5], ['treeArrowMarginTop', 6], ['treeArrowWidth', 13], ['treeGridHeight', 250], ['unhideIndicatorColor', 'rgba(0, 0, 0, 1)'], ['unhideIndicatorBackgroundColor', 'rgba(255, 255, 255, 1)'], ['unhideIndicatorBorderColor', 'rgba(174, 193, 232, 1)'], ['unhideIndicatorSize', 16], ['width', 'auto']]
1399
1846
  };
1400
1847
  }
1401
1848
 
@@ -1524,8 +1971,19 @@ __webpack_require__.r(__webpack_exports__);
1524
1971
  return;
1525
1972
  }
1526
1973
 
1527
- self.input.style.left = pos.left + cell.x + self.canvasOffsetLeft - s.left + 'px';
1528
- self.input.style.top = pos.top + cell.y - self.style.cellBorderWidth + self.canvasOffsetTop - s.top + 'px';
1974
+ var groupAreaOffsetY = self.getColumnGroupAreaHeight();
1975
+ var groupAreaOffsetX = self.getRowGroupAreaWidth();
1976
+
1977
+ if (self.parentNode) {
1978
+ var _self$parentNode = self.parentNode,
1979
+ columnGroupsAreaHeight = _self$parentNode.columnGroupsAreaHeight,
1980
+ rowGroupsAreaWidth = _self$parentNode.rowGroupsAreaWidth;
1981
+ if (columnGroupsAreaHeight) groupAreaOffsetY += columnGroupsAreaHeight;
1982
+ if (rowGroupsAreaWidth) groupAreaOffsetX += rowGroupsAreaWidth;
1983
+ }
1984
+
1985
+ self.input.style.left = pos.left + cell.x + self.canvasOffsetLeft - s.left + groupAreaOffsetX + 'px';
1986
+ self.input.style.top = pos.top + cell.y - self.style.cellBorderWidth + self.canvasOffsetTop - s.top + groupAreaOffsetY + 'px';
1529
1987
  self.input.style.height = cell.height - borderWidth + 'px';
1530
1988
  self.input.style.width = cell.width - self.style.cellPaddingLeft + 'px';
1531
1989
  self.clipElement(self.input);
@@ -1583,6 +2041,8 @@ __webpack_require__.r(__webpack_exports__);
1583
2041
  if (self.isChildGrid) {
1584
2042
  pos.x -= self.canvasOffsetLeft;
1585
2043
  pos.y -= self.canvasOffsetTop;
2044
+ if (self.parentNode.rowGroupsAreaWidth) pos.x -= self.parentNode.rowGroupsAreaWidth;
2045
+ if (self.parentNode.columnGroupsAreaHeight) pos.y -= self.parentNode.columnGroupsAreaHeight;
1586
2046
  }
1587
2047
 
1588
2048
  return {
@@ -2238,6 +2698,14 @@ __webpack_require__.r(__webpack_exports__);
2238
2698
  /*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
2239
2699
 
2240
2700
 
2701
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2702
+
2703
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2704
+
2705
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
2706
+
2707
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2708
+
2241
2709
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2242
2710
 
2243
2711
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -2351,6 +2819,105 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2351
2819
 
2352
2820
  img.src = 'data:image/svg+xml;base64,' + btoa('<svg xmlns="http://www.w3.org/2000/svg" width="' + cell.width + '" height="' + cell.height + '">\n' + '<foreignObject class="node" x="0" y="0" width="100%" height="100%">\n' + '<body xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0;">\n' + v + '\n' + '</body>' + '</foreignObject>\n' + '</svg>\n');
2353
2821
  }
2822
+ /**
2823
+ * @param {number[]} coords [x0,y0, x1,y1, x2,y2, ...]
2824
+ * @param {boolean} [fill] fill the area that construct by these lines but not stroke
2825
+ */
2826
+
2827
+
2828
+ function drawLines(coords, fill) {
2829
+ if (coords.length < 4) return;
2830
+ self.ctx.beginPath();
2831
+ self.ctx.moveTo(coords[0] + self.canvasOffsetLeft, coords[1] + self.canvasOffsetTop);
2832
+
2833
+ for (var i = 2; i < coords.length; i += 2) {
2834
+ var x = coords[i] + self.canvasOffsetLeft;
2835
+ var y = coords[i + 1] + self.canvasOffsetTop;
2836
+ self.ctx.lineTo(x, y);
2837
+ }
2838
+
2839
+ if (fill) self.ctx.fill();else self.ctx.stroke();
2840
+ }
2841
+ /**
2842
+ * @param {number} x based-X (left-top)
2843
+ * @param {number} y based-Y (left-top)
2844
+ * @param {number} width
2845
+ * @param {boolean} collapsed true: '+'; false: '-'
2846
+ */
2847
+
2848
+
2849
+ function drawGroupHandle(x, y, width, collapsed) {
2850
+ fillRect(x, y, width, width);
2851
+ strokeRect(x, y, width, width);
2852
+ var cx = x + width * 0.5;
2853
+ var cy = y + width * 0.5;
2854
+ drawLines([x + width * 0.2, cy, x + width * 0.78, cy]);
2855
+ if (collapsed) drawLines([cx, y + width * 0.22, cx, y + width * 0.8]);
2856
+ }
2857
+ /**
2858
+ * @param {number} x
2859
+ * @param {number} y
2860
+ * @param {number} size
2861
+ * @param {string} dir Direction of the triangle, one of the 't','b','l' and 'r'
2862
+ * @param {boolean} [active]
2863
+ */
2864
+
2865
+
2866
+ function drawUnhideIndicator(x, y, size, dir, active) {
2867
+ var minPadding = size * 0.2;
2868
+ var maxPadding = size * 0.3;
2869
+ /** The long edge width of the triangle */
2870
+
2871
+ var longEdge = size - 2 * minPadding;
2872
+ /** The median width of the triangle */
2873
+
2874
+ var median = size - 2 * maxPadding;
2875
+ var halfLongEdge = longEdge * 0.5;
2876
+ var x0, y0;
2877
+ var coords, borderCoords;
2878
+
2879
+ switch (dir) {
2880
+ case 'r':
2881
+ x0 = x + maxPadding;
2882
+ y0 = y + minPadding;
2883
+ borderCoords = [x, y, x + size, y, x + size, y + size, x, y + size];
2884
+ coords = [x0, y0, x0, y0 + longEdge, x0 + median, y0 + halfLongEdge];
2885
+ break;
2886
+
2887
+ case 'l':
2888
+ x0 = x + size - maxPadding;
2889
+ y0 = y + minPadding;
2890
+ borderCoords = [x + size, y, x, y, x, y + size, x + size, y + size];
2891
+ coords = [x0, y0, x0, y0 + longEdge, x0 - median, y0 + halfLongEdge];
2892
+ break;
2893
+
2894
+ case 't':
2895
+ x0 = x + minPadding;
2896
+ y0 = y + size - maxPadding;
2897
+ borderCoords = [x, y + size, x, y, x + size, y, x + size, y + size];
2898
+ coords = [x0, y0, x0 + longEdge, y0, x0 + halfLongEdge, y0 - median];
2899
+ break;
2900
+
2901
+ case 'b':
2902
+ x0 = x + minPadding;
2903
+ y0 = y + maxPadding;
2904
+ borderCoords = [x, y, x, y + size, x + size, y + size, x + size, y];
2905
+ coords = [x0, y0, x0 + longEdge, y0, x0 + halfLongEdge, y0 + median];
2906
+ break;
2907
+ }
2908
+
2909
+ if (active) {
2910
+ self.ctx.strokeStyle = self.style.unhideIndicatorBorderColor;
2911
+ self.ctx.lineWidth = 2;
2912
+ drawLines(borderCoords);
2913
+ self.ctx.fillStyle = self.style.unhideIndicatorBackgroundColor;
2914
+ var offset = dir === 'r' || dir === 'b' ? 1 : 0;
2915
+ if (dir === 'l' || dir === 'r') fillRect(x - offset, y, size + offset, size);else fillRect(x, y - offset, size, size + offset);
2916
+ }
2917
+
2918
+ self.ctx.fillStyle = self.style.unhideIndicatorColor;
2919
+ drawLines(coords, true);
2920
+ }
2354
2921
 
2355
2922
  function drawOrderByArrow(x, y) {
2356
2923
  var mt = self.style.columnHeaderOrderByArrowMarginTop * self.scale,
@@ -2414,6 +2981,52 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2414
2981
  return ml + aw + mr;
2415
2982
  }
2416
2983
 
2984
+ function drawCellTreeIcon(cell, tree, rowTree) {
2985
+ var parentCount = rowTree ? tree.parentCount : 0;
2986
+ var iconSize = self.style.cellTreeIconWidth * self.scale,
2987
+ marginTop = self.style.cellTreeIconMarginTop * self.scale,
2988
+ marginRight = self.style.cellTreeIconMarginRight * self.scale,
2989
+ marginLeft = self.style.cellTreeIconMarginLeft * self.scale + parentCount * (iconSize + cell.paddingLeft);
2990
+ var x = cell.x + cell.paddingLeft + self.canvasOffsetLeft + marginLeft,
2991
+ y = cell.y + self.canvasOffsetTop + marginTop;
2992
+
2993
+ if (tree.icon) {
2994
+ self.ctx.beginPath();
2995
+ var oldFillStyle = self.ctx.fillStyle;
2996
+ var oldStrokeStyle = self.ctx.strokeStyle;
2997
+
2998
+ if (cell.hovered && self.hovers.onCellTreeIcon) {
2999
+ self.ctx.fillStyle = self.style.cellTreeIconHoverFillColor;
3000
+ } else {
3001
+ self.ctx.fillStyle = self.style.cellTreeIconFillColor;
3002
+ }
3003
+
3004
+ self.ctx.fillRect(x, y, iconSize, iconSize);
3005
+ self.ctx.strokeStyle = self.style.cellTreeIconBorderColor;
3006
+ self.ctx.rect(x, y, iconSize, iconSize);
3007
+ self.ctx.stroke();
3008
+ self.ctx.beginPath();
3009
+
3010
+ if (tree.expand) {
3011
+ self.ctx.moveTo(x + 3, y + iconSize * 0.5);
3012
+ self.ctx.lineTo(x + iconSize - 3, y + iconSize * 0.5);
3013
+ } else {
3014
+ self.ctx.moveTo(x + 2, y + iconSize * 0.5);
3015
+ self.ctx.lineTo(x + iconSize - 2, y + iconSize * 0.5);
3016
+ self.ctx.moveTo(x + iconSize * 0.5, y + 2);
3017
+ self.ctx.lineTo(x + iconSize * 0.5, y + iconSize - 2);
3018
+ }
3019
+
3020
+ self.ctx.lineWidth = self.style.cellTreeIconLineWidth;
3021
+ self.ctx.strokeStyle = self.style.cellTreeIconLineColor;
3022
+ self.ctx.stroke();
3023
+ self.ctx.strokeStyle = oldStrokeStyle;
3024
+ self.ctx.fillStyle = oldFillStyle;
3025
+ }
3026
+
3027
+ return marginLeft + iconSize + marginRight;
3028
+ }
3029
+
2417
3030
  function drawFilterButtonArrow(x, y) {
2418
3031
  var mt = (self.style.filterButtonHeight - self.style.filterButtonArrowHeight) / 2 * self.scale,
2419
3032
  ml = (self.style.filterButtonWidth - self.style.filterButtonArrowWidth) / 2 * self.scale,
@@ -2719,6 +3332,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2719
3332
  }
2720
3333
 
2721
3334
  function drawText(cell) {
3335
+ var treeCellPadding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2722
3336
  var ll = cell.text.lines.length,
2723
3337
  h = cell.fontHeight * cell.lineHeight,
2724
3338
  x,
@@ -2729,12 +3343,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2729
3343
  for (x = 0; x < cell.text.lines.length; x += 1) {
2730
3344
  line = cell.text.lines[x];
2731
3345
  var vPos = Math.max((cell.height - (wrap ? cell.text.height : cell.calculatedLineHeight)) * 0.5, 0) + h,
2732
- hPos = cell.paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;
3346
+ hPos = cell.paddingLeft + treeCellPadding + cell.treeArrowWidth + cell.orderByArrowWidth;
2733
3347
 
2734
3348
  if (cell.horizontalAlignment === 'right') {
2735
- hPos = cell.paddingLeft + cell.paddedWidth - line.width;
3349
+ hPos = cell.paddingLeft + treeCellPadding + cell.paddedWidth - line.width;
2736
3350
  } else if (cell.horizontalAlignment === 'center') {
2737
- hPos = cell.paddingLeft + (cell.paddedWidth + cell.paddingRight) / 2 - line.width / 2;
3351
+ hPos = cell.paddingLeft + treeCellPadding + (cell.paddedWidth + cell.paddingRight) / 2 - line.width / 2;
2738
3352
  }
2739
3353
 
2740
3354
  if (cell.verticalAlignment === 'top') {
@@ -2780,6 +3394,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2780
3394
  s = self.getSchema(),
2781
3395
  x = 0,
2782
3396
  n = Math.min(self.frozenColumn, s.length),
3397
+ collapsedGroups = self.getCollapsedColumnGroups(),
2783
3398
  column;
2784
3399
  hiddenFrozenColumnCount = 0;
2785
3400
 
@@ -2789,7 +3404,15 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2789
3404
  if (column.hidden) {
2790
3405
  hiddenFrozenColumnCount += 1;
2791
3406
  } else {
2792
- w += self.getColumnWidth(x);
3407
+ var isCollapsed = collapsedGroups.findIndex(function (group) {
3408
+ return x >= group.from && x <= group.to;
3409
+ }) >= 0;
3410
+
3411
+ if (isCollapsed) {
3412
+ hiddenFrozenColumnCount += 1;
3413
+ } else {
3414
+ w += self.getColumnWidth(x);
3415
+ }
2793
3416
  }
2794
3417
 
2795
3418
  x += 1;
@@ -2867,7 +3490,31 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2867
3490
  u = self.currentCell || {},
2868
3491
  columnHeaderCellHeight = self.getColumnHeaderCellHeight(),
2869
3492
  rowHeaderCellWidth = self.getRowHeaderCellWidth(),
2870
- cellHeight = self.style.cellHeight;
3493
+ rowGroupsAreaWidth = self.getRowGroupAreaWidth(),
3494
+ columnGroupsAreaHeight = self.getColumnGroupAreaHeight(),
3495
+
3496
+ /** key: boundRowIndex, value: `{y,h}` */
3497
+ rowGroupsRectInfo = {},
3498
+
3499
+ /** value: `{y,h}` */
3500
+ rowGroupsFrozenInfo = {},
3501
+
3502
+ /** key: columnIndex, value: `{x,w}` */
3503
+ columnGroupsRectInfo = {},
3504
+ collapsedColumnGroups = self.getCollapsedColumnGroups(),
3505
+ collapsedRowGroups = self.getCollapsedRowGroups(),
3506
+ cellHeight = self.style.cellHeight,
3507
+ currentRowIndexOffset = 0,
3508
+
3509
+ /** @type {Array<{from:number,plus:number}>} */
3510
+ rowIndexOffsetByHiddenRows = self.hiddenRowRanges.map(function (range) {
3511
+ return {
3512
+ from: range[0],
3513
+ plus: range[1] - range[0] + 1
3514
+ };
3515
+ }).sort(function (a, b) {
3516
+ return a.from - b.from;
3517
+ });
2871
3518
  drawCount += 1;
2872
3519
  p = performance.now();
2873
3520
  self.visibleRowHeights = []; // if data length has changed, there is no way to know
@@ -2876,6 +3523,36 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2876
3523
  self.createRowOrders();
2877
3524
  }
2878
3525
 
3526
+ function saveRowGroupsRectInfo(cell) {
3527
+ var index = cell.boundRowIndex;
3528
+ if (index >= -1 === false) if (cell.rowIndex === -1) index = -1;else return;
3529
+ if (rowGroupsRectInfo[index]) return;
3530
+ rowGroupsRectInfo[index] = {
3531
+ y: cell.y,
3532
+ h: cell.height
3533
+ };
3534
+ }
3535
+
3536
+ function saveColumnGroupsRectInfo(cell) {
3537
+ var index = cell.columnIndex;
3538
+ if (columnGroupsRectInfo[index]) return;
3539
+ columnGroupsRectInfo[index] = {
3540
+ x: cell.x,
3541
+ w: cell.width
3542
+ };
3543
+ }
3544
+ /**
3545
+ * @param {number} columnIndex
3546
+ * @returns {boolean}
3547
+ */
3548
+
3549
+
3550
+ function isColumnCollapsedByGroup(columnIndex) {
3551
+ return collapsedColumnGroups.findIndex(function (group) {
3552
+ return columnIndex >= group.from && columnIndex <= group.to;
3553
+ }) >= 0;
3554
+ }
3555
+
2879
3556
  function drawScrollBars() {
2880
3557
  var drawCorner,
2881
3558
  en = self.scrollBox.entities,
@@ -3126,7 +3803,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3126
3803
  parentGrid: self.intf,
3127
3804
  innerHTML: '',
3128
3805
  activeHeader: activeHeader,
3129
- value: isHeader && !isRowHeader ? header.title || header.name : rawValue
3806
+ value: isHeader && !isRowHeader ? header.title || header.name : rawValue,
3807
+ isRowTree: rowOrderIndex >= 0 && columnOrderIndex == self.cellTree.rowTreeColIndex && self.cellTree.rows.length > 0 && self.cellTree.rows[rowOrderIndex].icon,
3808
+ isColumnTree: columnOrderIndex >= 0 && self.cellTree.columns[rowOrderIndex] && self.cellTree.columns[rowOrderIndex][columnOrderIndex].icon
3130
3809
  };
3131
3810
  cell.calculatedLineHeight = cell.fontHeight * cell.lineHeight + cell.lineSpacing;
3132
3811
  cell.paddedWidth = cell.width - cell.paddingRight - cell.paddingLeft;
@@ -3135,6 +3814,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3135
3814
  cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;
3136
3815
  cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[headerIndex];
3137
3816
  self.visibleCells.unshift(cell);
3817
+ saveRowGroupsRectInfo(cell);
3818
+ saveColumnGroupsRectInfo(cell);
3138
3819
 
3139
3820
  if (self.dispatchEvent('beforerendercell', ev)) {
3140
3821
  return;
@@ -3277,10 +3958,30 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3277
3958
  if (cell.innerHTML || header.type === 'html') {
3278
3959
  drawHtml(cell);
3279
3960
  } else {
3280
- drawText(cell);
3281
- }
3961
+ var treeCellPadding = 0,
3962
+ isDrawText = true;
3963
+ if (cell.columnIndex == self.cellTree.rowTreeColIndex && !cell.isColumnHeader && self.cellTree.rows.length > 0 && Object.keys(self.cellTree.rows[cell.rowIndex]).length > 1) treeCellPadding = drawCellTreeIcon(cell, self.cellTree.rows[cell.rowIndex], true);
3964
+
3965
+ if (!cell.isRowHeader && cell.rowIndex > 0 && self.cellTree.columns[cell.rowIndex - 1] && self.cellTree.columns[cell.rowIndex - 1][cell.columnIndex].icon) {
3966
+ for (var r = cell.rowIndex - 1; r >= 0; r--) {
3967
+ if (!self.cellTree.columns[r]) break;
3968
+ if (!self.cellTree.columns[r][cell.columnIndex].icon) break;
3969
+
3970
+ if (!self.cellTree.columns[r][cell.columnIndex].expand) {
3971
+ isDrawText = false;
3972
+ break;
3973
+ }
3974
+ }
3975
+ }
3282
3976
 
3283
- if (wrap && cell.text && cell.text.height > rowHeight) {
3977
+ if (isDrawText && !cell.isRowHeader && self.cellTree.columns[cell.rowIndex] && self.cellTree.columns[cell.rowIndex][cell.columnIndex].icon) {
3978
+ if (self.viewData.length > 0 && self.viewData[cell.rowIndex][cell.columnIndex].length > 0) treeCellPadding = drawCellTreeIcon(cell, self.cellTree.columns[cell.rowIndex][cell.columnIndex], false);
3979
+ }
3980
+
3981
+ if (isDrawText) drawText(cell, treeCellPadding);
3982
+ }
3983
+
3984
+ if (wrap && cell.text && cell.text.height > rowHeight) {
3284
3985
  self.sizes.rows[isHeader ? -1 : rowIndex] = cell.text.height;
3285
3986
  checkScrollHeight = true;
3286
3987
  }
@@ -3317,6 +4018,26 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3317
4018
  var previousRowNumber = self.getBoundRowIndexFromViewRowIndex(rowOrderIndex - 1);
3318
4019
  var hasRowGap = previousRowNumber !== undefined && cell.boundRowIndex > 0 && cell.boundRowIndex - previousRowNumber > 1;
3319
4020
 
4021
+ if (hasRowGap && collapsedRowGroups.length > 0) {
4022
+ hasRowGap = collapsedRowGroups.find(function (group) {
4023
+ return group.from === previousRowNumber && group.to === cell.boundRowIndex;
4024
+ }) >= 0;
4025
+ } // We don't treat the row index difference from hidden rows as the row gap.
4026
+
4027
+
4028
+ if (hasRowGap && self.hiddenRowRanges.length > 0) {
4029
+ for (var i = 0; i < self.hiddenRowRanges.length; i++) {
4030
+ var _self$hiddenRowRanges = _slicedToArray(self.hiddenRowRanges[i], 2),
4031
+ beginRowIndex = _self$hiddenRowRanges[0],
4032
+ endRowIndex = _self$hiddenRowRanges[1];
4033
+
4034
+ if (cell.boundRowIndex === endRowIndex + 1 && previousRowNumber === beginRowIndex - 1) {
4035
+ hasRowGap = false;
4036
+ break;
4037
+ }
4038
+ }
4039
+ }
4040
+
3320
4041
  if (hasRowGap) {
3321
4042
  var barHeight = self.style.rowHeaderCellRowNumberGapHeight;
3322
4043
  var barColor = self.style.rowHeaderCellRowNumberGapColor;
@@ -3325,11 +4046,162 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3325
4046
  fillRect(cell.x, cell.y - barHeight / 2, cell.width, barHeight);
3326
4047
  self.ctx.restore();
3327
4048
  }
3328
- }
4049
+ } //#region draw unhide indicator for column headers
4050
+
4051
+
4052
+ if (isColumnHeader && self.attributes.showUnhideColumnsIndicator) {
4053
+ var _hovered = self.hovers.unhideIndicator;
4054
+ var size = self.style.unhideIndicatorSize;
4055
+ var cellX = x;
4056
+ var topY = cell.y + Math.max(0.5 * (cell.height - size), 0);
4057
+
4058
+ var isActive = function isActive(orderIndex) {
4059
+ return _hovered && (_hovered.dir === 'l' || _hovered.dir === 'r') && orderIndex >= _hovered.orderIndex0 && orderIndex <= _hovered.orderIndex1;
4060
+ };
4061
+
4062
+ var isHiddenColumn = function isHiddenColumn(columnIndex) {
4063
+ return columnIndex >= 0 && schema[columnIndex] && schema[columnIndex].hidden;
4064
+ };
4065
+
4066
+ var orderIndex0, orderIndex1;
4067
+
4068
+ var drawIndicator = function drawIndicator(leftX, dir, active) {
4069
+ self.visibleUnhideIndicators.push({
4070
+ x: leftX - 1,
4071
+ y: topY - 1,
4072
+ x2: leftX + size + 2,
4073
+ y2: topY + size + 2,
4074
+ orderIndex0: orderIndex0,
4075
+ orderIndex1: orderIndex1,
4076
+ dir: dir
4077
+ });
4078
+
4079
+ if (!active) {
4080
+ var line = cell.text && cell.text.lines && cell.text.lines[0];
4081
+
4082
+ if (line) {
4083
+ var iconsWidth = orderByArrowSize + treeArrowSize;
4084
+ var lineX0 = iconsWidth > 0 ? iconsWidth : line.x;
4085
+ var lineX1 = line.x + line.width;
4086
+ if (leftX + size >= lineX0 && leftX <= lineX1) return;
4087
+ }
4088
+ }
4089
+
4090
+ drawUnhideIndicator(leftX, topY, size, dir, active);
4091
+ }; // end of drawIndicator
4092
+
4093
+
4094
+ var orderIndexPtr = columnOrderIndex - 1;
4095
+ var prevColumnIndex = self.orders.columns[orderIndexPtr];
4096
+
4097
+ if (isHiddenColumn(prevColumnIndex)) {
4098
+ var _active = isActive(prevColumnIndex);
4099
+
4100
+ orderIndex0 = orderIndexPtr;
4101
+ orderIndex1 = orderIndexPtr;
4102
+
4103
+ while (--orderIndexPtr >= 0) {
4104
+ if (isHiddenColumn(self.orders.columns[orderIndexPtr])) orderIndex0 = orderIndexPtr;else break;
4105
+ }
4106
+
4107
+ drawIndicator(cellX, 'r', _active);
4108
+ }
4109
+
4110
+ orderIndexPtr = columnOrderIndex + 1;
4111
+ var nextColumnIndex = self.orders.columns[orderIndexPtr];
4112
+
4113
+ if (isHiddenColumn(nextColumnIndex)) {
4114
+ var _active2 = isActive(nextColumnIndex);
4115
+
4116
+ orderIndex0 = orderIndexPtr;
4117
+ orderIndex1 = orderIndexPtr;
4118
+
4119
+ while (++orderIndexPtr < self.orders.columns.length) {
4120
+ if (isHiddenColumn(self.orders.columns[orderIndexPtr])) orderIndex1 = orderIndexPtr;else break;
4121
+ }
4122
+
4123
+ var indicatorX = x + cell.width - size;
4124
+ drawIndicator(indicatorX, 'l', _active2);
4125
+ }
4126
+ } //#endregion draw unhide indicator for column headers
4127
+ //#region draw unhide indicator for row headers
4128
+
4129
+
4130
+ if (isRowHeader && self.attributes.showUnhideRowsIndicator && self.hiddenRowRanges.length > 0) {
4131
+ // Leo's comment:
4132
+ // from the first row to the last row, `rowIndex` is from 0 to the count of rows
4133
+ // but `boundRowIndex` can be disordered if there are any ordered columns or filtered columns
4134
+ // Like this statement:
4135
+ // console.log(rowIndex, cell.boundRowIndex, cell.formattedValue);
4136
+ // can output the result like this:
4137
+ // 0 1 '2'
4138
+ // 1 3 '4'
4139
+ var _hovered2 = self.hovers.unhideIndicator;
4140
+ var _size = self.style.unhideIndicatorSize;
4141
+ var leftX = cell.x + cell.width - _size - 2;
4142
+ var cellY = y;
4143
+ var topIndicators = {};
4144
+ var bottomIndicators = {};
4145
+ self.hiddenRowRanges.forEach(function (it) {
4146
+ topIndicators[it[0] - 1] = it;
4147
+ bottomIndicators[it[1] + 1] = it;
4148
+ });
4149
+
4150
+ var _rowIndex = cell.rowIndex + currentRowIndexOffset;
4151
+
4152
+ var _isActive = function _isActive() {
4153
+ return _hovered2 && (_hovered2.dir === 't' || _hovered2.dir === 'b') && _rowIndex >= _hovered2.orderIndex0 - 1 && _rowIndex <= _hovered2.orderIndex1 + 1;
4154
+ };
4155
+
4156
+ var _orderIndex, _orderIndex2;
4157
+
4158
+ var _drawIndicator = function _drawIndicator(topY, dir, active) {
4159
+ self.visibleUnhideIndicators.push({
4160
+ x: leftX - 1,
4161
+ y: topY - 1,
4162
+ x2: leftX + _size + 2,
4163
+ y2: topY + _size + 2,
4164
+ orderIndex0: _orderIndex,
4165
+ orderIndex1: _orderIndex2,
4166
+ dir: dir
4167
+ });
4168
+ drawUnhideIndicator(leftX, topY, _size, dir, active);
4169
+ }; // end of drawIndicator
4170
+
4171
+
4172
+ var matched = topIndicators[_rowIndex];
4173
+
4174
+ if (matched) {
4175
+ var indicatorY = cellY + cell.height - _size;
4176
+ var _matched = matched;
4177
+
4178
+ var _matched2 = _slicedToArray(_matched, 2);
4179
+
4180
+ _orderIndex = _matched2[0];
4181
+ _orderIndex2 = _matched2[1];
4182
+
4183
+ _drawIndicator(indicatorY, 't', _isActive());
4184
+ }
4185
+
4186
+ matched = bottomIndicators[_rowIndex];
4187
+
4188
+ if (matched) {
4189
+ var _indicatorY = cellY;
4190
+ var _matched3 = matched;
4191
+
4192
+ var _matched4 = _slicedToArray(_matched3, 2);
4193
+
4194
+ _orderIndex = _matched4[0];
4195
+ _orderIndex2 = _matched4[1];
4196
+
4197
+ _drawIndicator(_indicatorY, 'b', _isActive());
4198
+ }
4199
+ } //#endregion draw unhide indicator for row headers
4200
+
3329
4201
 
3330
4202
  x += cell.width + (bc ? 0 : self.style.cellBorderWidth);
3331
4203
  return cell.width;
3332
- };
4204
+ }; // end of drawEach
3333
4205
  }
3334
4206
 
3335
4207
  function drawFilterButton(cell, ev) {
@@ -3366,8 +4238,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3366
4238
  // row index + 1. If rowIndex > viewData.length, it's a new row
3367
4239
  // added to the end, and we want to render that new row's number
3368
4240
 
3369
- var filteredRowNumber = self.viewData && rowIndex < self.viewData.length ? self.getBoundRowIndexFromViewRowIndex(rowIndex) + 1 : self.originalData ? self.originalData.length + 1 : rowOrderIndex + 1;
3370
- var rowHeaderValue = self.hasActiveFilters() ? filteredRowNumber : rowIndex + 1;
4241
+ var filteredRowNumber;
4242
+ if (self.viewData && rowIndex < self.viewData.length) filteredRowNumber = self.getBoundRowIndexFromViewRowIndex(rowIndex) + 1;else filteredRowNumber = self.originalData ? self.originalData.length + 1 : rowOrderIndex + 1;
4243
+ var rowHeaderValue = self.hasActiveFilters() || self.hasCollapsedRowGroup() ? filteredRowNumber : rowIndex + 1;
4244
+ rowHeaderValue += currentRowIndexOffset;
3371
4245
  var _rowHeaderCell = {
3372
4246
  rowHeaderCell: rowHeaderValue
3373
4247
  };
@@ -3381,6 +4255,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3381
4255
  };
3382
4256
  rowOpen = self.openChildren[rowIndex];
3383
4257
  drawCell(_rowHeaderCell, rowOrderIndex, rowIndex)(headerDescription, -1, -1);
4258
+
4259
+ if (rowIndexOffsetByHiddenRows[0] && rowHeaderValue >= rowIndexOffsetByHiddenRows[0].from) {
4260
+ var _rowIndexOffsetByHidd = rowIndexOffsetByHiddenRows.shift(),
4261
+ plus = _rowIndexOffsetByHidd.plus;
4262
+
4263
+ currentRowIndexOffset += plus;
4264
+ }
3384
4265
  }
3385
4266
  }
3386
4267
 
@@ -3400,7 +4281,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3400
4281
  i = self.orders.columns[o];
3401
4282
  header = schema[i];
3402
4283
 
3403
- if (!header.hidden) {
4284
+ if (!header.hidden && !isColumnCollapsedByGroup(o)) {
3404
4285
  d = {
3405
4286
  title: header.title,
3406
4287
  name: header.name,
@@ -3519,8 +4400,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3519
4400
  cellHeight = rowHeight; //draw normal columns
3520
4401
 
3521
4402
  for (columnOrderIndex = self.scrollIndexLeft; columnOrderIndex < g; columnOrderIndex += 1) {
3522
- headerIndex = self.orders.columns[columnOrderIndex];
3523
- x += drawCell(rowData, rowOrderIndex, rowIndex)(schema[headerIndex], headerIndex, columnOrderIndex);
4403
+ if (!isColumnCollapsedByGroup(columnOrderIndex)) {
4404
+ headerIndex = self.orders.columns[columnOrderIndex];
4405
+ x += drawCell(rowData, rowOrderIndex, rowIndex)(schema[headerIndex], headerIndex, columnOrderIndex);
4406
+ }
3524
4407
 
3525
4408
  if (x > self.width) {
3526
4409
  self.scrollIndexRight = columnOrderIndex;
@@ -3537,8 +4420,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3537
4420
  }
3538
4421
 
3539
4422
  for (columnOrderIndex = 0; columnOrderIndex < self.frozenColumn; columnOrderIndex += 1) {
3540
- headerIndex = self.orders.columns[columnOrderIndex];
3541
- x += drawCell(rowData, rowOrderIndex, rowIndex)(schema[headerIndex], headerIndex, columnOrderIndex);
4423
+ if (!isColumnCollapsedByGroup(columnOrderIndex)) {
4424
+ headerIndex = self.orders.columns[columnOrderIndex];
4425
+ x += drawCell(rowData, rowOrderIndex, rowIndex)(schema[headerIndex], headerIndex, columnOrderIndex);
4426
+ }
3542
4427
 
3543
4428
  if (x > self.width) {
3544
4429
  break;
@@ -3565,8 +4450,19 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3565
4450
  nodeType: 'canvas-datagrid-tree',
3566
4451
  scrollTop: self.scrollBox.scrollTop,
3567
4452
  scrollLeft: self.scrollBox.scrollLeft,
3568
- rowIndex: rowOrderIndex
4453
+ rowIndex: rowOrderIndex,
4454
+ columnGroupsAreaHeight: columnGroupsAreaHeight,
4455
+ rowGroupsAreaWidth: rowGroupsAreaWidth
3569
4456
  };
4457
+
4458
+ if (self.intf.parentNode) {
4459
+ var _self$intf$parentNode = self.intf.parentNode,
4460
+ _columnGroupsAreaHeight = _self$intf$parentNode.columnGroupsAreaHeight,
4461
+ _rowGroupsAreaWidth = _self$intf$parentNode.rowGroupsAreaWidth;
4462
+ treeGrid.parentNode.columnGroupsAreaHeight += _columnGroupsAreaHeight || 0;
4463
+ treeGrid.parentNode.rowGroupsAreaWidth += _rowGroupsAreaWidth || 0;
4464
+ }
4465
+
3570
4466
  self.visibleCells.unshift({
3571
4467
  rowIndex: rowOrderIndex,
3572
4468
  columnIndex: 0,
@@ -3593,10 +4489,19 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3593
4489
  self.visibleRows = [];
3594
4490
  schema = self.getSchema();
3595
4491
  self.visibleCells = [];
4492
+ self.visibleGroups = [];
4493
+ self.visibleUnhideIndicators = [];
3596
4494
  self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0.5;
3597
4495
  self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : -0.5;
3598
4496
  h = self.height;
3599
- w = self.width;
4497
+ w = self.width; // patch for first row being hidden
4498
+
4499
+ var firstRowIndexOffset = rowIndexOffsetByHiddenRows[0];
4500
+
4501
+ if (firstRowIndexOffset && firstRowIndexOffset.from === 0) {
4502
+ currentRowIndexOffset = firstRowIndexOffset.plus;
4503
+ rowIndexOffsetByHiddenRows.shift();
4504
+ }
3600
4505
  }
3601
4506
 
3602
4507
  function drawBackground() {
@@ -3606,6 +4511,427 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3606
4511
  fillRect(0, 0, w, h);
3607
4512
  }
3608
4513
 
4514
+ function initGroupArea() {
4515
+ self.ctx.translate(rowGroupsAreaWidth, columnGroupsAreaHeight);
4516
+ }
4517
+
4518
+ function drawGroupArea() {
4519
+ var mx = rowGroupsAreaWidth;
4520
+ var my = columnGroupsAreaHeight;
4521
+ var frozenColumnsWidth = getFrozenColumnsWidth();
4522
+ var frozenRowsHeight = rowGroupsFrozenInfo.y + rowGroupsFrozenInfo.h - columnHeaderCellHeight;
4523
+ var onTheLeft = self.attributes.columnGroupIndicatorPosition === 'left';
4524
+ var onTheTop = self.attributes.rowGroupIndicatorPosition === 'top';
4525
+ /** @type {CanvasRenderingContext2D} */
4526
+
4527
+ var ctx = self.ctx;
4528
+ ctx.save();
4529
+ ctx.fillStyle = self.style.groupingAreaBackgroundColor;
4530
+ fillRect(0, -my, w, my);
4531
+ fillRect(-mx, -my, mx, h);
4532
+ ctx.restore(); //#region Columns Grouping
4533
+
4534
+ /** it extends `self.groupedRows` */
4535
+
4536
+ var groupedColumns = [];
4537
+
4538
+ for (var row = 0; row < self.groupedColumns.length; row++) {
4539
+ var groups = self.groupedColumns[row];
4540
+
4541
+ for (var j = 0; j < groups.length; j++) {
4542
+ groupedColumns.push(Object.assign({
4543
+ row: row
4544
+ }, groups[j]));
4545
+ }
4546
+ }
4547
+
4548
+ if (groupedColumns.length > 0) {
4549
+ (function () {
4550
+ var rowHeight = self.style.columnGroupRowHeight;
4551
+ var toggleHandleSize = rowHeight * 0.5;
4552
+ var toggleHandlePadding = (rowHeight - toggleHandleSize) * 0.5;
4553
+
4554
+ var _loop = function _loop(i) {
4555
+ var group = groupedColumns[i];
4556
+ var row = group.row,
4557
+ collapsed = group.collapsed;
4558
+ var topY = -my + row * rowHeight;
4559
+ var centerY = topY + rowHeight * 0.5;
4560
+ var bottomY = topY + rowHeight - toggleHandlePadding;
4561
+ var leftmostX = rowHeaderCellWidth - toggleHandleSize - toggleHandlePadding;
4562
+
4563
+ var drawGroupHandleAtX = function drawGroupHandleAtX(x) {
4564
+ return drawGroupHandle(x, topY + toggleHandlePadding, toggleHandleSize, group.collapsed);
4565
+ };
4566
+
4567
+ var pushToVisibleGroups = function pushToVisibleGroups(leftX, rightX) {
4568
+ return self.visibleGroups.push({
4569
+ type: 'c',
4570
+ collapsed: collapsed,
4571
+ from: group.from,
4572
+ to: group.to,
4573
+ row: row,
4574
+ x: leftX + mx,
4575
+ y: topY + my,
4576
+ x2: rightX + mx,
4577
+ y2: bottomY + my
4578
+ });
4579
+ }; //#region check the relationship between this group and frozen columns
4580
+
4581
+
4582
+ var crossTheFrozen = group.from < self.frozenColumn && group.to >= self.frozenColumn;
4583
+ var notInFrozen = group.from >= self.frozenColumn; //#endregion
4584
+
4585
+ if (collapsed) {
4586
+ var _leftX = leftmostX + toggleHandleSize; // This group is not sticking on the first column
4587
+
4588
+
4589
+ if (group.from > 0) {
4590
+ var colIndex = group.to + 1;
4591
+ var col = columnGroupsRectInfo[colIndex];
4592
+
4593
+ if (!col) {
4594
+ colIndex = group.from - 1;
4595
+ col = columnGroupsRectInfo[colIndex];
4596
+ if (!col) return "continue"; // don't draw this group indicator because it is invisible
4597
+
4598
+ _leftX = col.x + col.w - toggleHandleSize * 0.5;
4599
+ } else {
4600
+ _leftX = col.x + toggleHandlePadding;
4601
+ }
4602
+
4603
+ if (colIndex >= self.frozenColumn) {
4604
+ var compare = frozenColumnsWidth + rowHeaderCellWidth - toggleHandlePadding; // don't draw this group indicator because it is hidden by frozen columns
4605
+
4606
+ if (_leftX < compare) return "continue";
4607
+ }
4608
+ }
4609
+
4610
+ var _rightX = _leftX + toggleHandleSize;
4611
+
4612
+ ctx.save();
4613
+ ctx.strokeStyle = self.style.groupIndicatorColor;
4614
+ ctx.fillStyle = self.style.groupIndicatorBackgroundColor;
4615
+ drawGroupHandleAtX(_leftX);
4616
+ ctx.restore();
4617
+ pushToVisibleGroups(_leftX, _rightX);
4618
+ } // end of collapsed group
4619
+
4620
+ /** @type {number} pointer for loop */
4621
+
4622
+
4623
+ var ptr = void 0;
4624
+ var left = columnGroupsRectInfo[group.from];
4625
+ var right = columnGroupsRectInfo[group.to];
4626
+ var containsBegining = true;
4627
+ var containsEnd = true;
4628
+ ptr = group.from;
4629
+
4630
+ while (!left && ptr < group.to) {
4631
+ left = columnGroupsRectInfo[++ptr];
4632
+ containsBegining = false;
4633
+ }
4634
+
4635
+ ptr = group.to;
4636
+
4637
+ while (!right && ptr > group.from) {
4638
+ right = columnGroupsRectInfo[--ptr];
4639
+ containsEnd = false;
4640
+ }
4641
+
4642
+ if (!left || !right) return "continue";
4643
+ var rightX = right.x + right.w;
4644
+ var leftX = left.x;
4645
+
4646
+ if (crossTheFrozen) {
4647
+ var rightCompare = columnGroupsRectInfo[self.frozenColumn - 1];
4648
+
4649
+ if (rightCompare) {
4650
+ var compareX = rightCompare.x + rightCompare.w;
4651
+ if (!onTheLeft) compareX += toggleHandleSize;
4652
+
4653
+ if (compareX >= rightX) {
4654
+ right = rightCompare;
4655
+ rightX = right.x + right.w;
4656
+ containsEnd = false;
4657
+ }
4658
+ }
4659
+ }
4660
+
4661
+ var minLeftX = rowHeaderCellWidth + (notInFrozen ? frozenColumnsWidth : 0);
4662
+ if (rightX + (onTheLeft ? 0 : toggleHandleSize) < minLeftX) return "continue";
4663
+ rightX -= toggleHandlePadding;
4664
+ leftX += toggleHandlePadding;
4665
+ ctx.save();
4666
+ ctx.strokeStyle = self.style.groupIndicatorColor;
4667
+ ctx.fillStyle = self.style.groupIndicatorBackgroundColor;
4668
+ var lineCoords = [];
4669
+
4670
+ if (onTheLeft) {
4671
+ // avoid lines from two groups be overlapping
4672
+ minLeftX += toggleHandlePadding * 2;
4673
+ if (leftX < minLeftX) leftX = minLeftX;
4674
+ if (group.from === 0) leftX -= toggleHandlePadding * 2;
4675
+
4676
+ if (rightX >= leftX) {
4677
+ lineCoords.push(leftX, centerY, rightX, centerY);
4678
+ if (containsEnd) lineCoords.push(rightX, bottomY);
4679
+ } else {
4680
+ rightX = leftX;
4681
+ }
4682
+
4683
+ leftX -= toggleHandleSize;
4684
+ drawGroupHandleAtX(leftX); // add more clickable area into `visibleGroups`
4685
+
4686
+ rightX += toggleHandlePadding - 1;
4687
+ } else {
4688
+ // handle on the right
4689
+ if (leftX < minLeftX) leftX = minLeftX;
4690
+ if (group.from === 0) leftX -= toggleHandlePadding * 2;
4691
+
4692
+ if (containsEnd) {
4693
+ if (group.to === self.frozenColumn - 1) {
4694
+ rightX -= toggleHandleSize;
4695
+ } else {
4696
+ rightX += toggleHandlePadding * 2;
4697
+ }
4698
+
4699
+ drawGroupHandleAtX(rightX);
4700
+ }
4701
+
4702
+ if (leftX > rightX) {
4703
+ leftX = rightX;
4704
+ } else {
4705
+ if (group.from === 0) {
4706
+ containsBegining = true;
4707
+ leftX = leftmostX + toggleHandleSize;
4708
+ }
4709
+
4710
+ if (containsBegining) lineCoords.push(leftX, bottomY);
4711
+ lineCoords.push(leftX, centerY, rightX, centerY);
4712
+ } // add more clickable area into `visibleGroups`
4713
+
4714
+
4715
+ leftX -= toggleHandlePadding + 1;
4716
+ if (containsEnd) rightX += toggleHandleSize;
4717
+ }
4718
+
4719
+ drawLines(lineCoords);
4720
+ ctx.restore();
4721
+ pushToVisibleGroups(leftX, rightX);
4722
+ };
4723
+
4724
+ for (var i = 0; i < groupedColumns.length; i++) {
4725
+ var _ret = _loop(i);
4726
+
4727
+ if (_ret === "continue") continue;
4728
+ }
4729
+ })();
4730
+ } //#endregion Columns Grouping
4731
+ //#region Rows Grouping
4732
+
4733
+ /** it extends `self.groupedRows` */
4734
+
4735
+
4736
+ var groupedRows = [];
4737
+
4738
+ for (var col = 0; col < self.groupedRows.length; col++) {
4739
+ var _groups = self.groupedRows[col];
4740
+
4741
+ for (var _j = 0; _j < _groups.length; _j++) {
4742
+ groupedRows.push(Object.assign({
4743
+ col: col
4744
+ }, _groups[_j]));
4745
+ }
4746
+ }
4747
+
4748
+ if (groupedRows.length > 0) {
4749
+ (function () {
4750
+ var colWidth = self.style.rowGroupColumnWidth;
4751
+ var toggleHandleSize = colWidth * 0.5;
4752
+ var toggleHandlePadding = (colWidth - toggleHandleSize) * 0.5;
4753
+
4754
+ var _loop2 = function _loop2(i) {
4755
+ var group = groupedRows[i];
4756
+ var col = group.col,
4757
+ collapsed = group.collapsed;
4758
+ var leftX = -mx + col * colWidth;
4759
+ var centerX = leftX + colWidth * 0.5;
4760
+ var rightX = leftX + colWidth - toggleHandlePadding;
4761
+ var topmostY = columnHeaderCellHeight - toggleHandleSize - toggleHandlePadding;
4762
+
4763
+ var drawGroupHandleAtY = function drawGroupHandleAtY(y) {
4764
+ return drawGroupHandle(leftX + toggleHandlePadding, y, toggleHandleSize, group.collapsed);
4765
+ };
4766
+
4767
+ var pushToVisibleGroups = function pushToVisibleGroups(topY, bottomY) {
4768
+ return self.visibleGroups.push({
4769
+ type: 'r',
4770
+ collapsed: collapsed,
4771
+ from: group.from,
4772
+ to: group.to,
4773
+ col: col,
4774
+ x: leftX + mx,
4775
+ y: topY + my,
4776
+ x2: rightX + mx,
4777
+ y2: bottomY + my
4778
+ });
4779
+ }; //#region check the relationship between this group and frozen columns
4780
+
4781
+
4782
+ var crossTheFrozen = group.from < self.frozenRow && group.to >= self.frozenRow;
4783
+ var notInFrozen = group.from >= self.frozenRow; //#endregion
4784
+
4785
+ if (collapsed) {
4786
+ var _topY = topmostY + toggleHandleSize; // This group is not sticking on the first column
4787
+
4788
+
4789
+ if (group.from > 0) {
4790
+ var _rowIndex2 = group.to + 1;
4791
+
4792
+ var _row = rowGroupsRectInfo[_rowIndex2];
4793
+
4794
+ if (!_row) {
4795
+ _rowIndex2 = group.from - 1;
4796
+ _row = rowGroupsRectInfo[_rowIndex2];
4797
+ if (!_row) return "continue"; // don't draw this group indicator because it is invisible
4798
+
4799
+ _topY = _row.y + _row.h - toggleHandleSize * 0.5;
4800
+ } else {
4801
+ _topY = _row.y;
4802
+ }
4803
+
4804
+ if (_rowIndex2 >= self.frozenRow) {
4805
+ var compare = frozenRowsHeight + columnHeaderCellHeight - toggleHandlePadding; // don't draw this group indicator because it is hidden by frozen columns
4806
+
4807
+ if (_topY < compare) return "continue";
4808
+ }
4809
+ }
4810
+
4811
+ var _bottomY = _topY + toggleHandleSize;
4812
+
4813
+ ctx.save();
4814
+ ctx.strokeStyle = self.style.groupIndicatorColor;
4815
+ ctx.fillStyle = self.style.groupIndicatorBackgroundColor;
4816
+ drawGroupHandleAtY(_topY);
4817
+ ctx.restore();
4818
+ pushToVisibleGroups(_topY, _bottomY);
4819
+ } // end of collapsed group
4820
+
4821
+ /** @type {number} pointer for loop */
4822
+
4823
+
4824
+ var ptr = void 0;
4825
+ var top = rowGroupsRectInfo[group.from];
4826
+ var bottom = rowGroupsRectInfo[group.to];
4827
+ var containsBegining = true;
4828
+ var containsEnd = true;
4829
+ ptr = group.from;
4830
+
4831
+ while (!top && ptr < group.to) {
4832
+ top = rowGroupsRectInfo[++ptr];
4833
+ containsBegining = false;
4834
+ }
4835
+
4836
+ ptr = group.to;
4837
+
4838
+ while (!bottom && ptr > group.from) {
4839
+ bottom = rowGroupsRectInfo[--ptr];
4840
+ containsEnd = false;
4841
+ }
4842
+
4843
+ if (!top || !bottom) return "continue";
4844
+ var bottomY = bottom.y + bottom.h;
4845
+ var topY = top.y;
4846
+
4847
+ if (crossTheFrozen) {
4848
+ var bottomCompare = rowGroupsRectInfo[self.frozenRow - 1];
4849
+
4850
+ if (bottomCompare) {
4851
+ var compareY = bottomCompare.y + bottomCompare.h;
4852
+ if (!onTheTop) compareY += toggleHandleSize;
4853
+
4854
+ if (compareY >= bottomY) {
4855
+ bottom = bottomCompare;
4856
+ bottomY = bottom.y + bottom.h;
4857
+ containsEnd = false;
4858
+ }
4859
+ }
4860
+ }
4861
+
4862
+ var minTopY = columnHeaderCellHeight + (notInFrozen ? frozenRowsHeight : 0);
4863
+ if (bottomY + (onTheTop ? 0 : toggleHandleSize) < minTopY) return "continue";
4864
+ bottomY -= toggleHandlePadding;
4865
+ topY += toggleHandlePadding;
4866
+ ctx.save();
4867
+ ctx.strokeStyle = self.style.groupIndicatorColor;
4868
+ ctx.fillStyle = self.style.groupIndicatorBackgroundColor;
4869
+ var lineCoords = [];
4870
+
4871
+ if (onTheTop) {
4872
+ // avoid lines from two groups be overlapping
4873
+ minTopY += toggleHandlePadding * 2;
4874
+ if (topY < minTopY) topY = minTopY;
4875
+ if (group.from === 0) topY -= toggleHandlePadding * 2;
4876
+
4877
+ if (bottomY >= topY) {
4878
+ lineCoords.push(centerX, topY, centerX, bottomY);
4879
+ if (containsEnd) lineCoords.push(rightX, bottomY);
4880
+ } else {
4881
+ bottomY = topY;
4882
+ }
4883
+
4884
+ topY -= toggleHandleSize;
4885
+ drawGroupHandleAtY(topY); // add more clickable area into `visibleGroups`
4886
+
4887
+ bottomY += toggleHandlePadding - 1;
4888
+ } else {
4889
+ // handle on the bottom
4890
+ if (topY < minTopY) topY = minTopY;
4891
+ if (group.from === 0) topY -= toggleHandlePadding * 2;
4892
+
4893
+ if (containsEnd) {
4894
+ if (group.to === self.frozenRow - 1) {
4895
+ bottomY -= toggleHandleSize;
4896
+ } else {// bottomY += toggleHandlePadding * 2;
4897
+ }
4898
+
4899
+ drawGroupHandleAtY(bottomY);
4900
+ }
4901
+
4902
+ if (topY > bottomY) {
4903
+ topY = bottomY;
4904
+ } else {
4905
+ if (group.from === 0) {
4906
+ containsBegining = true;
4907
+ topY = topmostY + toggleHandleSize;
4908
+ }
4909
+
4910
+ if (containsBegining) lineCoords.push(rightX, topY);
4911
+ lineCoords.push(centerX, topY, centerX, bottomY); // add more clickable area into `visibleGroups`
4912
+
4913
+ topY -= toggleHandlePadding + 1;
4914
+ } // add more clickable area into `visibleGroups`
4915
+
4916
+
4917
+ if (containsEnd) bottomY += toggleHandleSize;
4918
+ }
4919
+
4920
+ drawLines(lineCoords);
4921
+ ctx.restore();
4922
+ pushToVisibleGroups(topY, bottomY);
4923
+ };
4924
+
4925
+ for (var i = 0; i < groupedRows.length; i++) {
4926
+ var _ret2 = _loop2(i);
4927
+
4928
+ if (_ret2 === "continue") continue;
4929
+ }
4930
+ })();
4931
+ } //#endregion Rows Grouping
4932
+
4933
+ }
4934
+
3609
4935
  function drawFrozenRows() {
3610
4936
  var rowOrderIndex,
3611
4937
  ln = Math.min(viewData.length, self.frozenRow);
@@ -3651,6 +4977,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3651
4977
  rowOrderIndex = self.orders.rows[rowIndex];
3652
4978
  self.scrollIndexBottom = rowIndex;
3653
4979
  self.scrollPixelBottom = y;
4980
+ if (self.cellTree.rows.length > 0 && Object.keys(self.cellTree.rows[rowOrderIndex]).length > 0 && self.cellTree.rows[rowOrderIndex].hide) continue;
3654
4981
 
3655
4982
  if (!drawRow(rowOrderIndex, rowIndex)) {
3656
4983
  break;
@@ -3666,8 +4993,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3666
4993
  rowOpen = false;
3667
4994
 
3668
4995
  for (columnOrderIndex = self.scrollIndexLeft; columnOrderIndex < g; columnOrderIndex += 1) {
3669
- headerIndex = self.orders.columns[columnOrderIndex];
3670
- x += drawCell(self.newRow, viewData.length, viewData.length)(schema[headerIndex], headerIndex, columnOrderIndex);
4996
+ if (!isColumnCollapsedByGroup(columnOrderIndex)) {
4997
+ headerIndex = self.orders.columns[columnOrderIndex];
4998
+ x += drawCell(self.newRow, viewData.length, viewData.length)(schema[headerIndex], headerIndex, columnOrderIndex);
4999
+ }
3671
5000
 
3672
5001
  if (x > self.width + self.scrollBox.scrollLeft) {
3673
5002
  break;
@@ -3846,6 +5175,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3846
5175
  }
3847
5176
 
3848
5177
  function drawFrozenMarkers() {
5178
+ if (self.dragStartObject !== undefined) return;
3849
5179
  var my = self.lastFrozenRowPixel - self.style.frozenMarkerWidth,
3850
5180
  mx = self.lastFrozenColumnPixel - self.style.frozenMarkerBorderWidth,
3851
5181
  xHover = self.currentCell && self.currentCell.style === 'frozen-row-marker',
@@ -3871,13 +5201,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3871
5201
  self.ctx.strokeStyle = xHover ? self.style.frozenMarkerHoverBorderColor : self.style.frozenMarkerBorderColor;
3872
5202
  fillRect(0, my, self.width, self.style.frozenMarkerWidth);
3873
5203
  strokeRect(0, my, self.width, self.style.frozenMarkerWidth);
5204
+ var height = self.style.frozenMarkerWidth + self.style.frozenMarkerBorderWidth;
3874
5205
  self.visibleCells.unshift({
3875
5206
  x: 0,
3876
5207
  y: my,
3877
- height: self.style.frozenMarkerWidth + self.style.frozenMarkerBorderWidth,
5208
+ height: height,
3878
5209
  width: self.width,
3879
5210
  style: 'frozen-row-marker'
3880
5211
  });
5212
+ rowGroupsFrozenInfo = {
5213
+ y: my,
5214
+ h: height
5215
+ };
3881
5216
  }
3882
5217
 
3883
5218
  if (self.freezeMarkerPosition) {
@@ -4039,6 +5374,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4039
5374
  self.ctx.save();
4040
5375
  initDraw();
4041
5376
  drawBackground();
5377
+ initGroupArea();
4042
5378
  drawFrozenRows();
4043
5379
  drawRows();
4044
5380
  drawActiveCell();
@@ -4055,6 +5391,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4055
5391
  self.resize(true);
4056
5392
  }
4057
5393
 
5394
+ drawGroupArea();
4058
5395
  drawDebug();
4059
5396
  drawPerfLines();
4060
5397
 
@@ -4170,6 +5507,43 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4170
5507
  self.getRatio = function () {
4171
5508
  return Math.min(self.attributes.maxPixelRatio, (window.devicePixelRatio || 1) / (self.ctx.webkitBackingStorePixelRatio || self.ctx.mozBackingStorePixelRatio || self.ctx.msBackingStorePixelRatio || self.ctx.oBackingStorePixelRatio || self.ctx.backingStorePixelRatio || 1));
4172
5509
  };
5510
+ /**
5511
+ * @returns {number} dataWidth
5512
+ */
5513
+
5514
+
5515
+ self.refreshScrollCacheX = function () {
5516
+ var s = self.getSchema();
5517
+ self.scrollCache.x = [];
5518
+ /** @type {number} it will be used in `reduceSchema` only */
5519
+
5520
+ var frozenWidth = 0;
5521
+ var collapsedColumnGroups = self.getCollapsedColumnGroups();
5522
+
5523
+ var isColumnCollapsed = function isColumnCollapsed(columnIndex) {
5524
+ return collapsedColumnGroups.findIndex(function (group) {
5525
+ return columnIndex >= group.from && columnIndex <= group.to;
5526
+ }) >= 0;
5527
+ };
5528
+
5529
+ var dataWidth = s.reduce(function reduceSchema(accumulator, column, columnIndex) {
5530
+ // intentional redefintion of column. This causes scrollCache to be in the correct order
5531
+ var schemaIndex = self.orders.columns[columnIndex];
5532
+ var columnWidth = self.getColumnWidth(schemaIndex);
5533
+ column = s[schemaIndex];
5534
+ if (!column.hidden && !isColumnCollapsed(columnIndex)) accumulator += columnWidth;
5535
+
5536
+ if (columnIndex < self.frozenColumn) {
5537
+ self.scrollCache.x[columnIndex] = accumulator;
5538
+ frozenWidth = accumulator;
5539
+ } else {
5540
+ self.scrollCache.x[columnIndex] = Math.max(frozenWidth + columnWidth, accumulator);
5541
+ }
5542
+
5543
+ return accumulator;
5544
+ }, 0) || 0;
5545
+ return dataWidth;
5546
+ };
4173
5547
 
4174
5548
  self.resize = function (drawAfterResize) {
4175
5549
  if (!self.canvas) {
@@ -4228,8 +5602,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4228
5602
  l = (self.viewData || []).length,
4229
5603
  columnHeaderCellHeight = self.getColumnHeaderCellHeight(),
4230
5604
  rowHeaderCellWidth = self.getRowHeaderCellWidth(),
4231
- ch = self.style.cellHeight,
4232
- s = self.getSchema(); // sets actual DOM canvas element
5605
+ topGroupAreaHeight = self.getColumnGroupAreaHeight(),
5606
+ leftGroupAreaWidth = self.getRowGroupAreaWidth(),
5607
+ ch = self.style.cellHeight; // sets actual DOM canvas element
4233
5608
 
4234
5609
  function checkScrollBoxVisibility() {
4235
5610
  self.scrollBox.horizontalBarVisible = self.style.width !== 'auto' && dataWidth > self.scrollBox.width && self.style.overflowX !== 'hidden' || self.style.overflowX === 'scroll';
@@ -4239,8 +5614,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4239
5614
  }
4240
5615
 
4241
5616
  function setScrollBoxSize() {
4242
- self.scrollBox.width = self.width - rowHeaderCellWidth;
4243
- self.scrollBox.height = self.height - columnHeaderCellHeight;
5617
+ self.scrollBox.width = self.width - rowHeaderCellWidth - leftGroupAreaWidth;
5618
+ self.scrollBox.height = self.height - columnHeaderCellHeight - topGroupAreaHeight;
4244
5619
  }
4245
5620
 
4246
5621
  function setCanvasSize() {
@@ -4250,8 +5625,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4250
5625
 
4251
5626
  dims = {
4252
5627
  // HACK +1 ? maybe it's a magic cell border? Required to line up properly in auto height mode.
4253
- height: columnHeaderCellHeight + dataHeight + cellBorder + 1,
4254
- width: dataWidth + rowHeaderCellWidth + cellBorder
5628
+ height: columnHeaderCellHeight + topGroupAreaHeight + dataHeight + cellBorder + 1,
5629
+ width: dataWidth + rowHeaderCellWidth + cellBorder + leftGroupAreaWidth
4255
5630
  };
4256
5631
  ['width', 'height'].forEach(function (dim) {
4257
5632
  //TODO: support inherit
@@ -4267,7 +5642,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4267
5642
  });
4268
5643
  }
4269
5644
 
4270
- self.scrollCache.x = [];
5645
+ dataWidth = self.refreshScrollCacheX();
4271
5646
  self.scrollCache.y = [];
4272
5647
 
4273
5648
  for (x = 0; x < l; x += 1) {
@@ -4280,20 +5655,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4280
5655
  self.scrollCache.y[x] = dataHeight;
4281
5656
  }
4282
5657
 
4283
- dataWidth = s.reduce(function reduceSchema(accumulator, column, columnIndex) {
4284
- // intentional redefintion of column. This causes scrollCache to be in the correct order
4285
- column = s[self.orders.columns[columnIndex]];
4286
-
4287
- if (column.hidden) {
4288
- self.scrollCache.x[columnIndex] = accumulator;
4289
- return accumulator;
4290
- }
4291
-
4292
- var va = accumulator + self.getColumnWidth(self.orders.columns[columnIndex]);
4293
- self.scrollCache.x[columnIndex] = va;
4294
- return va;
4295
- }, 0) || 0;
4296
-
4297
5658
  if (self.attributes.showNewRow) {
4298
5659
  dataHeight += ch;
4299
5660
  }
@@ -4316,8 +5677,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4316
5677
  // non-controversial
4317
5678
 
4318
5679
 
4319
- self.scrollBox.top = columnHeaderCellHeight + columnHeaderCellBorder;
4320
- self.scrollBox.left = rowHeaderCellWidth; // width and height of scroll box
5680
+ self.scrollBox.top = columnHeaderCellHeight + topGroupAreaHeight + columnHeaderCellBorder;
5681
+ self.scrollBox.left = rowHeaderCellWidth + leftGroupAreaWidth; // width and height of scroll box
4321
5682
 
4322
5683
  setScrollBoxSize(); // is the data larger than the scroll box
4323
5684
 
@@ -4363,24 +5724,24 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4363
5724
  // the dragged mouse.
4364
5725
  // https://github.com/TonyGermaneri/canvas-datagrid/issues/97
4365
5726
 
4366
- self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight - self.scrollCache.y[self.frozenRow]) / dataHeight;
5727
+ self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight - topGroupAreaHeight - self.scrollCache.y[self.frozenRow]) / dataHeight;
4367
5728
  self.scrollBox.scrollBoxHeight = self.scrollBox.height * self.scrollBox.heightBoxRatio - self.style.scrollBarWidth - b - d;
4368
5729
  self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
4369
5730
  self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize); // horizontal
4370
5731
 
4371
5732
  n.x += rowHeaderCellWidth;
4372
- n.y += self.height - self.style.scrollBarWidth - d;
4373
- n.width = self.width - self.style.scrollBarWidth - rowHeaderCellWidth - d - m;
5733
+ n.y += self.height - self.style.scrollBarWidth - d - topGroupAreaHeight;
5734
+ n.width = self.width - self.style.scrollBarWidth - rowHeaderCellWidth - leftGroupAreaWidth - d - m;
4374
5735
  n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d; // horizontal box
4375
5736
 
4376
5737
  nb.y = n.y + self.style.scrollBarBoxMargin;
4377
5738
  nb.width = self.scrollBox.scrollBoxWidth;
4378
5739
  nb.height = self.style.scrollBarBoxWidth; // vertical
4379
5740
 
4380
- v.x += self.width - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;
5741
+ v.x += self.width - leftGroupAreaWidth - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;
4381
5742
  v.y += columnHeaderCellHeight + self.scrollCache.y[self.frozenRow];
4382
5743
  v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;
4383
- v.height = self.height - columnHeaderCellHeight - self.style.scrollBarWidth - d - m; // vertical box
5744
+ v.height = self.height - columnHeaderCellHeight - topGroupAreaHeight - self.style.scrollBarWidth - d - m; // vertical box
4384
5745
 
4385
5746
  vb.x = v.x + self.style.scrollBarBoxMargin;
4386
5747
  vb.y += self.scrollCache.y[self.frozenRow];
@@ -4483,6 +5844,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4483
5844
  self.mousemove = function (e, overridePos) {
4484
5845
  if (self.contextMenu || self.input) {
4485
5846
  return;
5847
+ } // Cancel dragging action if user ventures outside grid
5848
+
5849
+
5850
+ if (self.draggingItem && e.which === 0) {
5851
+ self.stopFreezeMove(e);
5852
+ self.mouseup(e);
5853
+ return;
4486
5854
  }
4487
5855
 
4488
5856
  self.mouse = overridePos || self.getLayerPos(e);
@@ -4530,6 +5898,21 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4530
5898
  }
4531
5899
 
4532
5900
  self.currentCell = cell;
5901
+
5902
+ if (!self.draggingItem && // It is not in dragging mode (avoid changing hovers frequent)
5903
+ cell && (cell.context === 'cell' || cell.context === self.cursorGrab)) {
5904
+ var indicator = self.getUnhideIndicator(self.mouse.x, self.mouse.y);
5905
+
5906
+ if (indicator) {
5907
+ self.cursor = 'pointer';
5908
+ self.hovers = {
5909
+ unhideIndicator: indicator
5910
+ };
5911
+ self.draw();
5912
+ return;
5913
+ }
5914
+ }
5915
+
4533
5916
  self.hovers = {};
4534
5917
 
4535
5918
  if (!self.draggingItem && cell) {
@@ -4542,13 +5925,26 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4542
5925
  self.hovers = {
4543
5926
  rowIndex: cell.rowIndex,
4544
5927
  columnIndex: cell.columnIndex,
4545
- onFilterButton: false
5928
+ onFilterButton: false,
5929
+ onCellTreeIcon: false
4546
5930
  };
4547
5931
 
4548
5932
  if (cell.isFilterable && x > cell.x + cell.width + self.canvasOffsetLeft - self.style.filterButtonWidth && x < cell.x + cell.width + self.canvasOffsetLeft && y > cell.y + cell.height + self.canvasOffsetTop - self.style.filterButtonHeight && y < cell.y + cell.height + self.canvasOffsetTop) {
4549
5933
  self.hovers.onFilterButton = true;
4550
5934
  self.draw();
4551
5935
  }
5936
+
5937
+ if (cell.isRowTree || cell.isColumnTree) {
5938
+ var pc = cell.isRowTree ? self.cellTree.rows[cell.rowIndex].parentCount : 0;
5939
+ var rc = self.style.cellTreeIconWidth * self.scale,
5940
+ rx = cell.x + cell.paddingLeft + self.canvasOffsetLeft + self.style.cellTreeIconMarginLeft + pc * (rc + cell.paddingLeft),
5941
+ ry = cell.y + self.canvasOffsetTop + self.style.cellTreeIconMarginTop * self.scale;
5942
+
5943
+ if (x >= rx && x <= rx + rc && y >= ry && y < ry + rc) {
5944
+ self.hovers.onCellTreeIcon = true;
5945
+ self.draw();
5946
+ }
5947
+ }
4552
5948
  }
4553
5949
 
4554
5950
  if (self.selecting || self.reorderObject) {
@@ -4577,6 +5973,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4577
5973
  dragBounds.right = s.length - 1;
4578
5974
  dragBounds.top = Math.min(sBounds.top, cell.rowIndex);
4579
5975
  dragBounds.bottom = Math.max(sBounds.bottom, cell.rowIndex);
5976
+ if (dragBounds.top < 0) dragBounds.top = 0;
5977
+ }
5978
+
5979
+ if (self.dragStartObject.rowIndex === -1) {
5980
+ sBounds = self.getSelectionBounds();
5981
+ dragBounds.left = cell.columnIndex === undefined ? sBounds.left : Math.min(sBounds.left, cell.columnIndex);
5982
+ dragBounds.right = cell.columnIndex === undefined ? sBounds.right : Math.max(sBounds.right, cell.columnIndex);
5983
+ dragBounds.top = -1;
5984
+ dragBounds.bottom = self.viewData.length - 1;
5985
+ if (dragBounds.left < 0) dragBounds.left = 0;
4580
5986
  }
4581
5987
 
4582
5988
  if (self.dragStartObject.rowIndex !== cell.rowIndex || self.dragStartObject.columnIndex !== cell.columnIndex) {
@@ -4584,8 +5990,22 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4584
5990
  }
4585
5991
 
4586
5992
  if (self.cellBoundaryCrossed || delta.x === 0 && delta.y === 0 || self.attributes.selectionMode === 'row') {
4587
- if ((self.attributes.selectionMode === 'row' || self.dragStartObject.columnIndex === -1) && self.rowBoundaryCrossed) {
4588
- self.selectRow(cell.rowIndex, ctrl, null, true);
5993
+ if (cell.rowIndex !== undefined && (self.attributes.selectionMode === 'row' || self.dragStartObject.columnIndex === -1) && self.rowBoundaryCrossed) {
5994
+ if (self.dragStartObject.rowIndex < cell.rowIndex) {
5995
+ dragBounds.top = self.dragStartObject.rowIndex;
5996
+ dragBounds.bottom = cell.rowIndex;
5997
+ } else {
5998
+ dragBounds.top = cell.rowIndex;
5999
+ dragBounds.bottom = self.dragStartObject.rowIndex;
6000
+ }
6001
+ } else if (cell.rowIndex !== undefined && (self.attributes.selectionMode === 'column' || self.dragStartObject.rowIndex === -1) && self.columnBoundaryCrossed) {
6002
+ if (self.dragStartObject.columnIndex < cell.columnIndex) {
6003
+ dragBounds.left = self.dragStartObject.columnIndex;
6004
+ dragBounds.right = cell.columnIndex;
6005
+ } else {
6006
+ dragBounds.left = cell.columnIndex;
6007
+ dragBounds.right = self.dragStartObject.columnIndex;
6008
+ }
4589
6009
  } else if (self.attributes.selectionMode !== 'row') {
4590
6010
  if (cell.hovered && self.hovers.onFilterButton) {
4591
6011
  if (cell.openedFilter) {
@@ -4609,12 +6029,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4609
6029
 
4610
6030
  self.draw();
4611
6031
  return;
6032
+ } else if (cell.hovered && self.hovers.onCellTreeIcon && e.type == 'mousedown') {
6033
+ self.toggleCollapseTree(cell.rowIndex, cell.columnIndex);
6034
+ return;
4612
6035
  } else {
4613
6036
  self.selectedFilterButton = {
4614
6037
  columnIndex: -1,
4615
6038
  rowIndex: -1
4616
6039
  };
4617
6040
  if (self.hovers.onFilterButton) return;
6041
+ if (self.hovers.onCellTreeIcon) return;
4618
6042
 
4619
6043
  if (!self.dragAddToSelection && cell.rowIndex !== undefined) {
4620
6044
  if (self.selections[cell.rowIndex] && self.selections[cell.rowIndex].indexOf(cell.columnIndex) !== -1) {
@@ -4669,6 +6093,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4669
6093
  }
4670
6094
  }
4671
6095
 
6096
+ var columnGroup = self.getColumnGroupAt(self.mouse.x, self.mouse.y);
6097
+ if (columnGroup) self.cursor = 'pointer';
6098
+ var rowGroup = self.getRowGroupAt(self.mouse.x, self.mouse.y);
6099
+ if (rowGroup) self.cursor = 'pointer';
4672
6100
  self.cellBoundaryCrossed = false;
4673
6101
  self.rowBoundaryCrossed = false;
4674
6102
  self.columnBoundaryCrossed = false;
@@ -4725,10 +6153,36 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4725
6153
  return;
4726
6154
  }
4727
6155
 
6156
+ var unhideIndicator = self.getUnhideIndicator(pos.x, pos.y);
6157
+
6158
+ if (unhideIndicator) {
6159
+ var dir = unhideIndicator.dir,
6160
+ orderIndex0 = unhideIndicator.orderIndex0,
6161
+ orderIndex1 = unhideIndicator.orderIndex1;
6162
+ if (dir === 'l' || dir === 'r') self.unhideColumns(orderIndex0, orderIndex1);else self.unhideRows(orderIndex0, orderIndex1);
6163
+ return;
6164
+ }
6165
+
6166
+ var group = self.getColumnGroupAt(pos.x, pos.y);
6167
+ if (!group) group = self.getRowGroupAt(pos.x, pos.y);
6168
+
6169
+ if (group) {
6170
+ if (self.toggleGroup(group)) {
6171
+ self.setStorageData();
6172
+ self.refresh();
6173
+ return;
6174
+ }
6175
+ }
6176
+
4728
6177
  if (!self.hasFocus) {
4729
6178
  return;
4730
6179
  }
4731
6180
 
6181
+ var leftOffset = self.getRowGroupAreaWidth();
6182
+ var topOffset = self.getColumnGroupAreaHeight();
6183
+ var xInGrid = pos.x - leftOffset;
6184
+ var yInGrid = pos.y - topOffset;
6185
+
4732
6186
  if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {
4733
6187
  if (!self.hovers.onFilterButton) {
4734
6188
  self.setActiveCell(i.columnIndex, i.rowIndex);
@@ -4760,7 +6214,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4760
6214
  self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];
4761
6215
 
4762
6216
  if (self.attributes.selectionMode === 'row' || self.currentCell.style === 'rowHeaderCell') {
4763
- if (self.currentCell.style === 'rowHeaderCell' && self.attributes.tree && pos.x > 0 && pos.x - self.currentCell.x < self.style.treeArrowWidth + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius && pos.y - self.currentCell.y < self.style.treeArrowHeight + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius && pos.y > 0) {
6217
+ if (self.currentCell.style === 'rowHeaderCell' && self.attributes.tree && xInGrid > 0 && xInGrid - self.currentCell.x < self.style.treeArrowWidth + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius && yInGrid - self.currentCell.y < self.style.treeArrowHeight + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius && yInGrid > 0) {
4764
6218
  self.toggleTree(i.rowIndex);
4765
6219
  return;
4766
6220
  }
@@ -4800,7 +6254,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4800
6254
 
4801
6255
  if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone && self.dragMode === 'ew-resize') {
4802
6256
  self.resize(true);
4803
- self.scrollBox.scrollLeft += x;
4804
6257
  }
4805
6258
 
4806
6259
  if (self.dragMode === 'ew-resize') {
@@ -5113,6 +6566,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5113
6566
  rowHeaderCellWidth = self.getRowHeaderCellWidth();
5114
6567
  self.ignoreNextClick = true;
5115
6568
  self.freezeMarkerPosition = pos;
6569
+ pos.x -= self.getRowGroupAreaWidth();
6570
+ pos.y -= self.getColumnGroupAreaHeight();
5116
6571
 
5117
6572
  if (self.currentCell && self.currentCell.rowIndex !== undefined && self.dragMode === 'frozen-row-marker') {
5118
6573
  self.scrollBox.scrollTop = 0;
@@ -5127,11 +6582,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5127
6582
  }
5128
6583
 
5129
6584
  if (self.currentCell && self.currentCell.columnIndex !== undefined && self.dragMode === 'frozen-column-marker') {
6585
+ var dataWidth = self.refreshScrollCacheX();
5130
6586
  self.scrollBox.scrollLeft = 0;
5131
6587
  self.frozenColumn = self.currentCell.columnIndex + 1;
5132
6588
  self.scrollBox.bar.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1];
5133
- self.scrollBox.box.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1];
5134
- var dataWidth = self.scrollCache.x[self.scrollCache.x.length - 1];
6589
+ self.scrollBox.box.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1]; // var dataWidth = self.scrollCache.x[self.scrollCache.x.length - 1];
6590
+
5135
6591
  self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn - 1]) / dataWidth;
5136
6592
  self.scrollBox.scrollBoxWidth = self.scrollBox.width * self.scrollBox.widthBoxRatio - self.style.scrollBarWidth;
5137
6593
  self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
@@ -5185,6 +6641,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5185
6641
  move = /-move/.test(self.dragMode),
5186
6642
  freeze = /frozen-row-marker|frozen-column-marker/.test(self.dragMode),
5187
6643
  resize = /-resize/.test(self.dragMode);
6644
+ var onUnhideIndicator = self.hovers && self.hovers.unhideIndicator;
5188
6645
  self.dragStart = overridePos || self.getLayerPos(e);
5189
6646
  self.scrollStart = {
5190
6647
  left: self.scrollBox.scrollLeft,
@@ -5203,7 +6660,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5203
6660
  return;
5204
6661
  }
5205
6662
 
5206
- if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {
6663
+ if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1 && !onUnhideIndicator) {
5207
6664
  self.scrollMode = self.dragStartObject.context;
5208
6665
  self.scrollStartMode = self.dragStartObject.context;
5209
6666
  self.scrollGrid(e);
@@ -5227,6 +6684,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5227
6684
 
5228
6685
  if ((self.attributes.selectionMode === 'row' || self.dragStartObject.columnIndex === -1) && self.dragStartObject.rowIndex > -1) {
5229
6686
  self.selectRow(self.dragStartObject.rowIndex, ctrl, null);
6687
+ } else if ((self.attributes.selectionMode === 'column' || self.dragStartObject.rowIndex === -1) && self.dragStartObject.columnIndex > -1) {
6688
+ self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
5230
6689
  } else if (self.attributes.selectionMode !== 'row') {
5231
6690
  self.mousemove(e);
5232
6691
  }
@@ -5269,7 +6728,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5269
6728
  return self.mousemove(e);
5270
6729
  }
5271
6730
 
5272
- if (resize) {
6731
+ if (resize && !onUnhideIndicator) {
5273
6732
  self.draggingItem = self.dragItem;
5274
6733
 
5275
6734
  if (self.draggingItem.rowOpen) {
@@ -5611,8 +7070,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5611
7070
  }
5612
7071
  } else if (self.currentCell.context === 'ew-resize' && self.currentCell.style === 'cornerCell') {
5613
7072
  self.autosize();
5614
- } else if (['cell', 'activeCell'].includes(self.currentCell.style) && !self.hovers.onFilterButton) {
5615
- self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);
7073
+ } else if (['cell', 'activeCell'].includes(self.currentCell.style) && !self.hovers.onFilterButton && !self.hovers.onCellTreeIcon) {
7074
+ if (self.currentCell.isRowTree || self.currentCell.isColumnTree) {
7075
+ self.cellTreeExpandCollapse(self.currentCell.rowIndex, self.currentCell.columnIndex);
7076
+ self.draw();
7077
+ } else {
7078
+ self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);
7079
+ }
5616
7080
  }
5617
7081
  };
5618
7082
 
@@ -6036,7 +7500,7 @@ var createHTMLString = function createHTMLString(selectedData, isNeat) {
6036
7500
  var htmlString = '<table>';
6037
7501
  htmlString += selectedData.map(function (row) {
6038
7502
  return '<tr>' + Object.values(row).map(function (value) {
6039
- return '<td>' + htmlSafe(value) + '</td>';
7503
+ return ['<td>', htmlSafe(value), '</td>'].join('');
6040
7504
  }).join('') + '</tr>';
6041
7505
  }).join('');
6042
7506
  htmlString += '</table>';
@@ -6045,6 +7509,90 @@ var createHTMLString = function createHTMLString(selectedData, isNeat) {
6045
7509
 
6046
7510
 
6047
7511
 
7512
+ /***/ }),
7513
+
7514
+ /***/ "./lib/groups/util.js":
7515
+ /*!****************************!*\
7516
+ !*** ./lib/groups/util.js ***!
7517
+ \****************************/
7518
+ /*! namespace exports */
7519
+ /*! export mergeHiddenRowRanges [provided] [no usage info] [missing usage info prevents renaming] */
7520
+ /*! other exports [not provided] [no usage info] */
7521
+ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
7522
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7523
+
7524
+ "use strict";
7525
+ __webpack_require__.r(__webpack_exports__);
7526
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7527
+ /* harmony export */ "mergeHiddenRowRanges": function() { return /* binding */ mergeHiddenRowRanges; }
7528
+ /* harmony export */ });
7529
+
7530
+ /**
7531
+ * Merge a new hidden row range into existed ranges array
7532
+ * @param {any[]} hiddenRowRanges tuples: Array<[bgeinRowIndex, endRowIndex]>
7533
+ * @param {number[]} newRange tuple: [beginRowIndex, endRowIndex]
7534
+ * @returns {boolean}
7535
+ */
7536
+
7537
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7538
+
7539
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7540
+
7541
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7542
+
7543
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7544
+
7545
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
7546
+
7547
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7548
+
7549
+ var mergeHiddenRowRanges = function mergeHiddenRowRanges(hiddenRowRanges, newRange) {
7550
+ var _newRange = _slicedToArray(newRange, 2),
7551
+ beginRowIndex = _newRange[0],
7552
+ endRowIndex = _newRange[1];
7553
+
7554
+ if (endRowIndex < beginRowIndex) return false;
7555
+ var inserted = false;
7556
+
7557
+ for (var i = 0; i < hiddenRowRanges.length; i++) {
7558
+ var range = hiddenRowRanges[i];
7559
+ if (beginRowIndex > range[1] + 1) continue;
7560
+
7561
+ if (beginRowIndex <= range[0] && endRowIndex >= range[0]) {
7562
+ hiddenRowRanges[i] = [beginRowIndex, Math.max(endRowIndex, range[1])];
7563
+ inserted = true;
7564
+ break;
7565
+ }
7566
+
7567
+ if (beginRowIndex >= range[0]) {
7568
+ hiddenRowRanges[i] = [range[0], Math.max(endRowIndex, range[1])];
7569
+ inserted = true;
7570
+ break;
7571
+ }
7572
+ }
7573
+
7574
+ if (!inserted) hiddenRowRanges.push([beginRowIndex, endRowIndex]); // merge intersections after sorting ranges
7575
+
7576
+ hiddenRowRanges.sort(function (a, b) {
7577
+ return a[0] - b[0];
7578
+ });
7579
+
7580
+ for (var _i2 = 0; _i2 < hiddenRowRanges.length - 1; _i2++) {
7581
+ var _range = hiddenRowRanges[_i2];
7582
+ var nextRange = hiddenRowRanges[_i2 + 1];
7583
+
7584
+ if (nextRange[0] <= _range[1] + 1) {
7585
+ hiddenRowRanges[_i2] = [_range[0], Math.max(_range[1], nextRange[1])];
7586
+ hiddenRowRanges.splice(_i2 + 1, 1);
7587
+ _i2--;
7588
+ }
7589
+ }
7590
+
7591
+ return true;
7592
+ };
7593
+
7594
+
7595
+
6048
7596
  /***/ }),
6049
7597
 
6050
7598
  /***/ "./lib/intf.js":
@@ -6068,6 +7616,14 @@ __webpack_require__.r(__webpack_exports__);
6068
7616
  /*globals HTMLElement: false, Reflect: false, define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
6069
7617
 
6070
7618
 
7619
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
7620
+
7621
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7622
+
7623
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
7624
+
7625
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7626
+
6071
7627
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
6072
7628
 
6073
7629
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -6138,6 +7694,36 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6138
7694
  self.scrollBox = {};
6139
7695
  self.visibleRows = [];
6140
7696
  self.visibleCells = [];
7697
+ /**
7698
+ * Each item of this array contains these properties:
7699
+ * - `x`, `y`, `x2`, `y2`
7700
+ * - `orderIndex0`, `orderIndex1`: The closed interval of the hiding rows/columns.
7701
+ * - `dir`: The directon of the unhide indicator. 'l' and 'r' for columns, 't' and 'b' for rows
7702
+ */
7703
+
7704
+ self.visibleUnhideIndicators = [];
7705
+ /**
7706
+ * Each item is a tuple conatins two numbers:
7707
+ * its type difination: Array<[beginRowIndex, endRowIndex]>
7708
+ * Each tuple represents a closed Interval
7709
+ */
7710
+
7711
+ self.hiddenRowRanges = [];
7712
+ /**
7713
+ * This array stored all groups information with context for drawing,
7714
+ * it is generated by drawing functions,
7715
+ * and be used for searching groups when users operate on the spreadsheet
7716
+ * Each item of this array contains these properties:
7717
+ * - `type`: its available values: 'c' and 'r'. indicates the type of this item, 'c' for column group
7718
+ * and 'r' for row group.
7719
+ * - `x`,`y`: the left-top point of this group's rendering area.
7720
+ * - `x2`, `y2`: the right-bottom of this group's rendering area.
7721
+ * - `collapsed`: this value indicates the collapsed status of this group.
7722
+ * - `from`, `to`: The column index range of this group (We use this value for searching the group)
7723
+ * - `row`: The row index for column groups (We use this value for searching the group)
7724
+ */
7725
+
7726
+ self.visibleGroups = [];
6141
7727
  self.sizes = {
6142
7728
  rows: {},
6143
7729
  columns: {},
@@ -6152,6 +7738,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6152
7738
  columnIndex: -1,
6153
7739
  rowIndex: -1
6154
7740
  };
7741
+ self.cellTree = {
7742
+ rows: [],
7743
+ columns: {},
7744
+ tempSchema: {},
7745
+ rowTreeColIndex: 0,
7746
+ columnTreeRowStartIndex: 0,
7747
+ columnTreeRowEndIndex: 0,
7748
+ origin: {
7749
+ rows: [],
7750
+ columns: {}
7751
+ }
7752
+ };
6155
7753
  self.hovers = {};
6156
7754
  self.attributes = {};
6157
7755
  self.style = {};
@@ -6167,9 +7765,31 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6167
7765
  self.scrollPixelLeft = 0;
6168
7766
  self.childGrids = {};
6169
7767
  self.openChildren = {};
7768
+ /**
7769
+ * Array for grouped columns
7770
+ * Each item in this array is an array and it represents some grouping in one row
7771
+ * A grouping descriptor has three properties:
7772
+ * - `from`: The column index of the first column
7773
+ * - `to`: The column index of the last column
7774
+ * - `collapsed`: Is this group be collapsed
7775
+ * @example [[{ from: 1, to: 2, collapsed: false }]]
7776
+ */
7777
+
7778
+ self.groupedColumns = [];
7779
+ /**
7780
+ * Array for grouped rows
7781
+ * Each item in this array is an array and it represents some grouping in one column
7782
+ * A grouping descriptor has three properties:
7783
+ * - `from`: The row index of the first row
7784
+ * - `to`: The row index of the last row
7785
+ * - `collapsed`: Is this group be collapsed
7786
+ * @example [[{ from: 1, to: 2, collapsed: false }]]
7787
+ */
7788
+
7789
+ self.groupedRows = [];
6170
7790
  self.scrollModes = ['vertical-scroll-box', 'vertical-scroll-top', 'vertical-scroll-bottom', 'horizontal-scroll-box', 'horizontal-scroll-right', 'horizontal-scroll-left'];
6171
7791
  self.componentL1Events = {};
6172
- self.eventNames = ['afterdraw', 'afterrendercell', 'afterrenderfilterbutton', 'attributechanged', 'beforebeginedit', 'beforecreatecellgrid', 'beforedraw', 'beforeendedit', 'beforerendercell', 'beforerendercellgrid', 'beforerenderfilterbutton', 'beginedit', 'cellmouseout', 'cellmouseover', 'click', 'collapsetree', 'contextmenu', 'copy', 'datachanged', 'dblclick', 'endedit', 'expandtree', 'formatcellvalue', 'keydown', 'keypress', 'keyup', 'mousedown', 'mousemove', 'mouseup', 'newrow', 'ordercolumn', 'rendercell', 'rendercellgrid', 'renderorderbyarrow', 'rendertext', 'rendertreearrow', 'reorder', 'reordering', 'resize', 'resizecolumn', 'resizerow', 'schemachanged', 'scroll', 'selectionchanged', 'stylechanged', 'touchcancel', 'touchend', 'touchmove', 'touchstart', 'wheel'];
7792
+ self.eventNames = ['afterdraw', 'afterrendercell', 'afterrenderfilterbutton', 'aftercreategroup', 'attributechanged', 'beforebeginedit', 'beforecreatecellgrid', 'beforedraw', 'beforeendedit', 'beforerendercell', 'beforerendercellgrid', 'beforerenderfilterbutton', 'beginedit', 'cellmouseout', 'cellmouseover', 'click', 'collapsetree', 'contextmenu', 'copy', 'datachanged', 'dblclick', 'endedit', 'expandtree', 'formatcellvalue', 'keydown', 'keypress', 'keyup', 'mousedown', 'mousemove', 'mouseup', 'newrow', 'ordercolumn', 'rendercell', 'rendercellgrid', 'renderorderbyarrow', 'rendertext', 'rendertreearrow', 'reorder', 'reordering', 'resize', 'resizecolumn', 'resizerow', 'schemachanged', 'scroll', 'selectionchanged', 'stylechanged', 'touchcancel', 'touchend', 'touchmove', 'touchstart', 'wheel'];
6173
7793
  self.mouse = {
6174
7794
  x: 0,
6175
7795
  y: 0
@@ -6387,7 +8007,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6387
8007
  if (columnIndex < 0) continue;
6388
8008
  var boundColumnIndex = self.getBoundColumnIndexFromViewColumnIndex(columnIndex);
6389
8009
  var columnName = schema[boundColumnIndex].name;
6390
- self.viewData[boundRowIndex][columnName] = '';
8010
+ self.originalData[boundRowIndex][columnName] = '';
6391
8011
  affectedCells.push([rowIndex, columnIndex, boundRowIndex, boundColumnIndex]);
6392
8012
  }
6393
8013
  } catch (err) {
@@ -6416,6 +8036,166 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6416
8036
  self.getBoundColumnIndexFromViewColumnIndex = function (viewColumnIndex) {
6417
8037
  return self.orders.columns[viewColumnIndex];
6418
8038
  };
8039
+ /**
8040
+ * Get the height of the area about column groups for rendering and handling events.
8041
+ */
8042
+
8043
+
8044
+ self.getColumnGroupAreaHeight = function () {
8045
+ if (!self.attributes.allowGroupingColumns) {
8046
+ return 0;
8047
+ }
8048
+
8049
+ var groups = self.groupedColumns.length;
8050
+ var base = self.style.columnGroupRowHeight * self.scale;
8051
+ return base * groups;
8052
+ };
8053
+ /**
8054
+ * Get the width of the area about row groups for rendering and handling events.
8055
+ */
8056
+
8057
+
8058
+ self.getRowGroupAreaWidth = function () {
8059
+ if (!self.attributes.allowGroupingRows) {
8060
+ return 0;
8061
+ }
8062
+
8063
+ var groups = self.groupedRows.length;
8064
+ var base = self.style.rowGroupColumnWidth * self.scale;
8065
+ return base * groups;
8066
+ };
8067
+
8068
+ self.getCollapsedColumnGroups = function () {
8069
+ var result = [];
8070
+
8071
+ for (var rowIndex = 0; rowIndex < self.groupedColumns.length; rowIndex++) {
8072
+ var groups = self.groupedColumns[rowIndex];
8073
+
8074
+ for (var groupIndex = 0; groupIndex < groups.length; groupIndex++) {
8075
+ var group = groups[groupIndex];
8076
+ if (group.collapsed) result.push(group);
8077
+ }
8078
+ }
8079
+
8080
+ return result;
8081
+ };
8082
+
8083
+ self.getCollapsedRowGroups = function () {
8084
+ var result = [];
8085
+
8086
+ for (var rowIndex = 0; rowIndex < self.groupedRows.length; rowIndex++) {
8087
+ var groups = self.groupedRows[rowIndex];
8088
+
8089
+ for (var groupIndex = 0; groupIndex < groups.length; groupIndex++) {
8090
+ var group = groups[groupIndex];
8091
+ if (group.collapsed) result.push(group);
8092
+ }
8093
+ }
8094
+
8095
+ return result;
8096
+ };
8097
+ /**
8098
+ * Toggle the collapse status of a group (expanded/collapsed)
8099
+ * @param {{type:string,from:number,to:number}} group
8100
+ */
8101
+
8102
+
8103
+ self.toggleGroup = function (group) {
8104
+ if (group.type === 'c') {
8105
+ var from = group.from,
8106
+ to = group.to;
8107
+ /** @type {{from:number,to:number,collapsed:boolean}} */
8108
+
8109
+ var matchedGroup;
8110
+ /** @type {Array<Array<{from:number,to:number,collapsed:boolean}>>} */
8111
+
8112
+ var allGroups = self.groupedColumns;
8113
+
8114
+ for (var i = 0; i < allGroups.length; i++) {
8115
+ var groups = allGroups[i];
8116
+
8117
+ for (var gi = 0; gi < groups.length; gi++) {
8118
+ var _group = groups[gi];
8119
+
8120
+ if (_group.from === from && _group.to === to) {
8121
+ matchedGroup = _group;
8122
+ break;
8123
+ }
8124
+ }
8125
+
8126
+ if (matchedGroup) break;
8127
+ }
8128
+
8129
+ if (!matchedGroup) return;
8130
+ var nextCollapsed = !matchedGroup.collapsed;
8131
+ matchedGroup.collapsed = nextCollapsed;
8132
+ return true;
8133
+ }
8134
+
8135
+ if (group.type === 'r') {
8136
+ var _from = group.from,
8137
+ _to = group.to;
8138
+ /** @type {{from:number,to:number,collapsed:boolean}} */
8139
+
8140
+ var _matchedGroup;
8141
+ /** @type {Array<Array<{from:number,to:number,collapsed:boolean}>>} */
8142
+
8143
+
8144
+ var _allGroups = self.groupedRows;
8145
+
8146
+ for (var _i3 = 0; _i3 < _allGroups.length; _i3++) {
8147
+ var _groups = _allGroups[_i3];
8148
+
8149
+ for (var _gi = 0; _gi < _groups.length; _gi++) {
8150
+ var _group2 = _groups[_gi];
8151
+
8152
+ if (_group2.from === _from && _group2.to === _to) {
8153
+ _matchedGroup = _group2;
8154
+ break;
8155
+ }
8156
+ }
8157
+
8158
+ if (_matchedGroup) break;
8159
+ }
8160
+
8161
+ if (!_matchedGroup) return;
8162
+
8163
+ var _nextCollapsed = !_matchedGroup.collapsed;
8164
+
8165
+ _matchedGroup.collapsed = _nextCollapsed;
8166
+ return true;
8167
+ }
8168
+
8169
+ return false;
8170
+ };
8171
+
8172
+ self.isNewGroupRangeValid = function (groupsArray, from, to) {
8173
+ for (var i = 0; i < groupsArray.length; i++) {
8174
+ var groups = groupsArray[i];
8175
+
8176
+ for (var gIndex = 0; gIndex < groups.length; gIndex++) {
8177
+ var group = groups[gIndex];
8178
+ if (from === group.to + 1) return false;
8179
+ if (from > group.to) continue;
8180
+
8181
+ if (from === group.from) {
8182
+ if (to === group.to) return false;
8183
+ if (to > group.to) return true;
8184
+ break; // check smaller range
8185
+ }
8186
+
8187
+ if (from > group.from) {
8188
+ if (to > group.to) return false;
8189
+ break; // check smaller range
8190
+ }
8191
+
8192
+ if (to < group.to) return false;
8193
+ return true;
8194
+ }
8195
+ }
8196
+
8197
+ return true;
8198
+ };
6419
8199
 
6420
8200
  self.getColumnHeaderCellHeight = function () {
6421
8201
  if (!self.attributes.showColumnHeaders) {
@@ -6568,6 +8348,19 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6568
8348
  return self.columnFilters && Object.keys(self.columnFilters).length > 0;
6569
8349
  };
6570
8350
 
8351
+ self.hasCollapsedRowGroup = function () {
8352
+ for (var i = 0; i < self.groupedRows.length; i++) {
8353
+ var groups = self.groupedRows[i];
8354
+
8355
+ for (var j = 0; j < groups.length; j++) {
8356
+ var g = groups[j];
8357
+ if (g.collapsed) return true;
8358
+ }
8359
+ }
8360
+
8361
+ return false;
8362
+ };
8363
+
6571
8364
  self.getFilteredAndSortedViewData = function (originalData) {
6572
8365
  // We make a copy of originalData here in order be able to
6573
8366
  // filter and sort rows without modifying the original array.
@@ -6577,10 +8370,26 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6577
8370
  // useful when emitting cell events.
6578
8371
  var newViewData = originalData.map(function (row, originalRowIndex) {
6579
8372
  return [row, originalRowIndex];
6580
- }); // Apply filtering
8373
+ }); // Remove hidden rows here. So we can keep the bound indexes correct
8374
+
8375
+ if (self.hiddenRowRanges.length > 0) {
8376
+ var ranges = self.hiddenRowRanges.sort(function (a, b) {
8377
+ return b[1] - a[1];
8378
+ });
8379
+
8380
+ for (var i = 0; i < ranges.length; i++) {
8381
+ var _ranges$i = _slicedToArray(ranges[i], 2),
8382
+ beginRowIndex = _ranges$i[0],
8383
+ endRowIndex = _ranges$i[1];
8384
+
8385
+ var countOfRows = endRowIndex - beginRowIndex + 1;
8386
+ newViewData.splice(beginRowIndex, countOfRows);
8387
+ }
8388
+ } // Apply filtering
8389
+
6581
8390
 
6582
8391
  var _loop = function _loop() {
6583
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2),
8392
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i4], 2),
6584
8393
  headerName = _Object$entries2$_i[0],
6585
8394
  filterText = _Object$entries2$_i[1];
6586
8395
 
@@ -6601,11 +8410,81 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6601
8410
  });
6602
8411
  };
6603
8412
 
6604
- for (var _i3 = 0, _Object$entries2 = Object.entries(self.columnFilters); _i3 < _Object$entries2.length; _i3++) {
8413
+ for (var _i4 = 0, _Object$entries2 = Object.entries(self.columnFilters); _i4 < _Object$entries2.length; _i4++) {
6605
8414
  var _ret = _loop();
6606
8415
 
6607
8416
  if (_ret === "continue") continue;
6608
- } // Apply sorting
8417
+ } //#region Hide rows from collapsed group
8418
+
8419
+ /** @type {number[][]} */
8420
+
8421
+
8422
+ var collapsedGroups = [];
8423
+
8424
+ for (var _i5 = 0; _i5 < self.groupedRows.length; _i5++) {
8425
+ var rows = self.groupedRows[_i5];
8426
+
8427
+ for (var j = 0; j < rows.length; j++) {
8428
+ var r = rows[j];
8429
+ if (!r.collapsed) continue;
8430
+ collapsedGroups.push([r.from, r.to]);
8431
+ }
8432
+ }
8433
+
8434
+ if (collapsedGroups.length > 0) {
8435
+ //#region merge groups
8436
+ collapsedGroups.sort(function (a, b) {
8437
+ return a[0] - b[0];
8438
+ });
8439
+ var newLen = 0;
8440
+ var len = collapsedGroups.length;
8441
+
8442
+ for (var _i6 = 0; _i6 < len; _i6++) {
8443
+ var _r = collapsedGroups[_i6];
8444
+
8445
+ if (_i6 === len - 1) {
8446
+ collapsedGroups[newLen++] = _r;
8447
+ break;
8448
+ }
8449
+
8450
+ var to = _r[1];
8451
+
8452
+ var _collapsedGroups = _slicedToArray(collapsedGroups[_i6 + 1], 2),
8453
+ from2 = _collapsedGroups[0],
8454
+ to2 = _collapsedGroups[1];
8455
+
8456
+ if (from2 > to + 1) {
8457
+ collapsedGroups[newLen++] = _r;
8458
+ continue;
8459
+ }
8460
+
8461
+ collapsedGroups[_i6 + 1] = _r;
8462
+ if (to2 > to) collapsedGroups[_i6 + 1][1] = to2;
8463
+ }
8464
+
8465
+ collapsedGroups = collapsedGroups.slice(0, newLen); //#endregion merge groups
8466
+ //#region omit rows by groups
8467
+
8468
+ var g = collapsedGroups.shift();
8469
+
8470
+ for (var start = 0; start < newViewData.length; start++) {
8471
+ var it = newViewData[start][1];
8472
+ if (it < g[0]) continue;
8473
+ var end = start + 1;
8474
+
8475
+ for (; end < newViewData.length; end++) {
8476
+ var it2 = newViewData[end][1];
8477
+ if (it2 > g[1]) break;
8478
+ }
8479
+
8480
+ newViewData.splice(start, end - start);
8481
+ g = collapsedGroups.shift();
8482
+ if (!g) break;
8483
+ start--;
8484
+ } //#endregion omit rows by groups
8485
+
8486
+ } //#endregion Hide rows from collapsed group
8487
+ // Apply sorting
6609
8488
 
6610
8489
 
6611
8490
  var _iterator8 = _createForOfIteratorHelper(self.orderings.columns),
@@ -6820,47 +8699,383 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6820
8699
  }
6821
8700
  };
6822
8701
 
6823
- self.getDomRoot = function () {
6824
- return self.shadowRoot ? self.shadowRoot.host : self.parentNode;
6825
- };
8702
+ self.toggleCollapseTree = function (rowIndex, columnIndex, type) {
8703
+ var tempData = [];
8704
+ var collapsedCount = 0;
6826
8705
 
6827
- self.getFontName = function (fontStyle) {
6828
- return fontStyle.replace(/\d+\.?\d*px/, '');
6829
- };
8706
+ if (columnIndex == self.cellTree.rowTreeColIndex && (rowIndex > 0 || rowIndex == 0 && self.cellTree.rows[0].icon)) {
8707
+ var ctr = self.cellTree.rows;
6830
8708
 
6831
- self.getFontHeight = function (fontStyle) {
6832
- return parseFloat(fontStyle, 10);
6833
- };
8709
+ switch (type) {
8710
+ case 'Expand':
8711
+ ctr[rowIndex].expand = true;
8712
+ self.cellTree.origin.rows[ctr[rowIndex].index].expand = true;
8713
+ break;
6834
8714
 
6835
- self.parseStyleValue = function (key) {
6836
- if (/Font/.test(key)) {
6837
- self.style[key + 'Height'] = self.getFontHeight(self.style[key]);
6838
- self.style[key + 'Name'] = self.getFontName(self.style[key]);
6839
- return;
6840
- } // when inheriting styles from already instantiated grids, don't parse already parsed values.
8715
+ case 'Collapse':
8716
+ ctr[rowIndex].expand = false;
8717
+ self.cellTree.origin.rows[ctr[rowIndex].index].expand = false;
8718
+ break;
6841
8719
 
8720
+ default:
8721
+ ctr[rowIndex].expand = !ctr[rowIndex].expand;
8722
+ self.cellTree.origin.rows[ctr[rowIndex].index].expand = ctr[rowIndex].expand;
8723
+ }
6842
8724
 
6843
- if (key === 'moveOverlayBorderSegments' && typeof self.style[key] === 'string') {
6844
- self.style[key] = self.style[key].split(',').map(function (i) {
6845
- return parseInt(i, 10);
6846
- });
6847
- }
6848
- };
8725
+ for (var ri = ctr[rowIndex].index + 1; ri <= ctr[rowIndex].lastchild; ri++) {
8726
+ var orTree = self.cellTree.origin.rows[ri];
6849
8727
 
6850
- self.initProp = function (propName) {
6851
- if (!self.args[propName]) {
6852
- return;
6853
- }
8728
+ if (ctr[rowIndex].expand) {
8729
+ orTree.hide = false;
8730
+ if (orTree.icon && !orTree.expand) ri = orTree.lastchild;
8731
+ } else {
8732
+ orTree.hide = true;
8733
+ }
8734
+ }
8735
+ } else if (self.cellTree.columns[rowIndex]) {
8736
+ var ctc = self.cellTree.columns[rowIndex];
6854
8737
 
6855
- Object.keys(self.args[propName]).forEach(function (key) {
6856
- self[propName][key] = self.args[propName][key];
6857
- });
6858
- };
8738
+ switch (type) {
8739
+ case 'Expand':
8740
+ ctc[columnIndex].expand = true;
8741
+ break;
6859
8742
 
6860
- self.getStyleProperty = function (key) {
6861
- if (self.styleKeys.indexOf(key) === -1) {
6862
- return self.parentNodeStyle[key];
6863
- }
8743
+ case 'Collapse':
8744
+ ctc[columnIndex].expand = false;
8745
+ break;
8746
+
8747
+ default:
8748
+ ctc[columnIndex].expand = !ctc[columnIndex].expand;
8749
+ }
8750
+
8751
+ for (var ci = ctc[columnIndex].index + 1; ci <= ctc[columnIndex].lastchild; ci++) {
8752
+ if (ctc[columnIndex].expand) self.cellTree.tempSchema[ci].hidden = false;else self.cellTree.tempSchema[ci].hidden = true;
8753
+ }
8754
+
8755
+ var rc = 0,
8756
+ _ri;
8757
+
8758
+ if (ctc[columnIndex].expand) {
8759
+ while (rc < ctc[columnIndex].child) {
8760
+ _ri = rowIndex + rc + 1;
8761
+
8762
+ for (var _ci = ctc[columnIndex].index; _ci <= ctc[columnIndex].lastchild; _ci++) {
8763
+ if (self.cellTree.origin.columns[_ri] && self.cellTree.origin.columns[_ri][_ci].icon && !self.cellTree.origin.columns[_ri][_ci].expand) {
8764
+ for (var si = _ci + 1; si <= self.cellTree.origin.columns[_ri][_ci].lastchild; si++) {
8765
+ self.cellTree.tempSchema[si].hidden = true;
8766
+ }
8767
+ }
8768
+ }
8769
+
8770
+ rc++;
8771
+ }
8772
+ }
8773
+ }
8774
+
8775
+ var otherData = {};
8776
+ var collapsed = [];
8777
+ self.cellTree.rows = [];
8778
+ self.cellTree.columns = {};
8779
+
8780
+ for (var k in self.cellTree.origin.rows) {
8781
+ var tempRow = [];
8782
+ var tree = self.cellTree.origin.rows[k];
8783
+
8784
+ if (!tree.hide) {
8785
+ var colTrees = [];
8786
+ var collapsedColCount = 0;
8787
+
8788
+ if (k < self.cellTree.columnTreeRowStartIndex) {
8789
+ tempData.push(self.originalData[k]);
8790
+ } else {
8791
+ if (k > self.cellTree.columnTreeRowEndIndex) {
8792
+ otherData[k] = self.viewData[k];
8793
+ collapsedCount++;
8794
+ } else {
8795
+ for (var l = 0; l < self.originalData[k].length; l++) {
8796
+ if (!self.cellTree.tempSchema[l].hidden) {
8797
+ if (l < self.cellTree.rowTreeColIndex) {
8798
+ if (!Object.prototype.hasOwnProperty.call(otherData, k)) otherData[k] = [];
8799
+ otherData[k].push(self.viewData[k][l]);
8800
+ }
8801
+
8802
+ tempRow.push(self.originalData[k][l]);
8803
+ if (Object.prototype.hasOwnProperty.call(self.cellTree.origin.columns, k)) colTrees.push(self.cellTree.origin.columns[k][l]);
8804
+ } else collapsedColCount++;
8805
+ }
8806
+
8807
+ tempRow.push.apply(tempRow, _toConsumableArray(Array(collapsedColCount).fill().map(function () {
8808
+ return '';
8809
+ })));
8810
+
8811
+ if (colTrees.length) {
8812
+ colTrees.push.apply(colTrees, _toConsumableArray(Array(collapsedColCount).fill().map(function () {
8813
+ return {};
8814
+ })));
8815
+ self.cellTree.columns[k] = colTrees;
8816
+ }
8817
+
8818
+ tempData.push(tempRow);
8819
+ }
8820
+ }
8821
+
8822
+ self.cellTree.rows.push(tree);
8823
+ } else {
8824
+ for (var _l = 0; _l < self.cellTree.rowTreeColIndex; _l++) {
8825
+ tempRow.push(self.viewData[k][_l]);
8826
+ }
8827
+
8828
+ otherData[k] = tempRow;
8829
+ collapsed.push(Array(self.viewData[0].length).fill().map(function () {
8830
+ return '';
8831
+ }));
8832
+ collapsedCount++;
8833
+ }
8834
+ }
8835
+
8836
+ if (collapsedCount) {
8837
+ var _self$cellTree$rows;
8838
+
8839
+ (_self$cellTree$rows = self.cellTree.rows).push.apply(_self$cellTree$rows, _toConsumableArray(Array(collapsedCount).fill().map(function (u, index) {
8840
+ return {
8841
+ index: self.cellTree.rows.length + index
8842
+ };
8843
+ })));
8844
+
8845
+ tempData.push.apply(tempData, collapsed);
8846
+ }
8847
+
8848
+ for (var _k in otherData) {
8849
+ if (_k > self.cellTree.columnTreeRowEndIndex) tempData[_k] = otherData[_k];else for (var _l2 in otherData[_k]) {
8850
+ tempData[_k][_l2] = otherData[_k][_l2];
8851
+ }
8852
+ }
8853
+
8854
+ self.viewData = tempData;
8855
+ };
8856
+
8857
+ self.cellTreeExpandCollapse = function (rowIndex, columnIndex, type) {
8858
+ if (columnIndex == self.cellTree.rowTreeColIndex && (rowIndex > 0 || rowIndex == 0 && self.cellTree.rows[0].icon)) {
8859
+ var ctr = self.cellTree.rows;
8860
+
8861
+ switch (type) {
8862
+ case 'Expand':
8863
+ ctr[rowIndex].expand = true;
8864
+ break;
8865
+
8866
+ case 'Collapse':
8867
+ ctr[rowIndex].expand = false;
8868
+ break;
8869
+
8870
+ default:
8871
+ ctr[rowIndex].expand = !ctr[rowIndex].expand;
8872
+ }
8873
+
8874
+ for (var ri = rowIndex + 1; ri <= ctr[rowIndex].lastchild; ri++) {
8875
+ if (ctr[rowIndex].expand) {
8876
+ ctr[ri].hide = false;
8877
+ if (ctr[ri].icon && !ctr[ri].expand) ri = ctr[ri].lastchild;
8878
+ } else {
8879
+ ctr[ri].hide = true;
8880
+ }
8881
+ }
8882
+ } else if (self.cellTree.columns[rowIndex]) {
8883
+ var ctc = self.cellTree.columns[rowIndex];
8884
+
8885
+ switch (type) {
8886
+ case 'Expand':
8887
+ ctc[columnIndex].expand = true;
8888
+ break;
8889
+
8890
+ case 'Collapse':
8891
+ ctc[columnIndex].expand = false;
8892
+ break;
8893
+
8894
+ default:
8895
+ ctc[columnIndex].expand = !ctc[columnIndex].expand;
8896
+ }
8897
+
8898
+ for (var ci = columnIndex + 1; ci <= ctc[columnIndex].lastchild; ci++) {
8899
+ if (ctc[columnIndex].expand) self.tempSchema[ci].hidden = false;else self.tempSchema[ci].hidden = true;
8900
+ }
8901
+
8902
+ var rc = 0,
8903
+ _ri2;
8904
+
8905
+ if (ctc[columnIndex].expand) {
8906
+ while (rc < ctc[columnIndex].child) {
8907
+ _ri2 = rowIndex + rc + 1;
8908
+
8909
+ for (var _ci2 = columnIndex; _ci2 <= ctc[columnIndex].lastchild; _ci2++) {
8910
+ if (self.cellTree.columns[_ri2] && self.cellTree.columns[_ri2][_ci2].icon && !self.cellTree.columns[_ri2][_ci2].expand) {
8911
+ for (var si = _ci2 + 1; si <= self.cellTree.columns[_ri2][_ci2].lastchild; si++) {
8912
+ self.tempSchema[si].hidden = true;
8913
+ }
8914
+ }
8915
+ }
8916
+
8917
+ rc++;
8918
+ }
8919
+ }
8920
+ }
8921
+ };
8922
+
8923
+ self.initCellTreeSettings = function () {
8924
+ if (self.viewData === undefined) return;
8925
+
8926
+ if (self.attributes.rowTree.length > 0 && self.viewData.length > 0) {
8927
+ self.cellTree.rows = Array(self.viewData.length).fill().map(function (u, index) {
8928
+ return {
8929
+ index: index
8930
+ };
8931
+ });
8932
+ self.cellTree.rowTreeColIndex = self.attributes.rowTreeColIndex;
8933
+ var invalidRowTree = false;
8934
+
8935
+ var _iterator9 = _createForOfIteratorHelper(self.attributes.rowTree),
8936
+ _step9;
8937
+
8938
+ try {
8939
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
8940
+ var rt = _step9.value;
8941
+
8942
+ if (self.cellTree.rows.length <= rt.end) {
8943
+ invalidRowTree = true;
8944
+ break;
8945
+ }
8946
+
8947
+ for (var ri = rt.begin; ri <= rt.end; ri++) {
8948
+ if (ri == rt.begin) {
8949
+ self.cellTree.rows[ri].icon = true;
8950
+ self.cellTree.rows[ri].lastchild = rt.end;
8951
+ self.cellTree.rows[ri].expand = true;
8952
+ if (!self.cellTree.rows[ri].parentCount) self.cellTree.rows[ri].parentCount = 0;
8953
+ } else {
8954
+ self.cellTree.rows[ri].hide = false;
8955
+ self.cellTree.rows[ri].parentIndex = rt.begin;
8956
+ if (self.cellTree.rows[ri] && self.cellTree.rows[ri].parentCount) self.cellTree.rows[ri].parentCount += 1;else self.cellTree.rows[ri].parentCount = 1;
8957
+ }
8958
+ }
8959
+ }
8960
+ } catch (err) {
8961
+ _iterator9.e(err);
8962
+ } finally {
8963
+ _iterator9.f();
8964
+ }
8965
+
8966
+ if (invalidRowTree) self.cellTree.rows = {};
8967
+ }
8968
+
8969
+ if (self.attributes.columnTree.length > 0 && self.viewData.length > 0) {
8970
+ self.cellTree.columnTreeRowStartIndex = self.attributes.columnTreeRowStartIndex;
8971
+ self.cellTree.columnTreeRowEndIndex = self.attributes.columnTreeRowEndIndex;
8972
+ var dataColumnLength = Object.keys(self.viewData[0]).length;
8973
+ var invalidColumnTree = false;
8974
+
8975
+ var _iterator10 = _createForOfIteratorHelper(self.attributes.columnTree),
8976
+ _step10;
8977
+
8978
+ try {
8979
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
8980
+ var ct = _step10.value;
8981
+
8982
+ if (dataColumnLength <= ct.end) {
8983
+ invalidColumnTree = true;
8984
+ break;
8985
+ }
8986
+
8987
+ if (!self.cellTree.columns[ct.row]) self.cellTree.columns[ct.row] = Array(dataColumnLength).fill().map(function (u, index) {
8988
+ return {
8989
+ index: index
8990
+ };
8991
+ });
8992
+
8993
+ for (var i = ct.begin; i <= ct.end; i++) {
8994
+ var ctc = self.cellTree.columns[ct.row][i];
8995
+
8996
+ if (i == ct.begin) {
8997
+ ctc.icon = true;
8998
+ ctc.lastchild = ct.end;
8999
+ ctc.length = ct.end - ct.begin;
9000
+ ctc.expand = true;
9001
+ if (ct.child) ctc.child = ct.child;else ctc.child = 0;
9002
+ }
9003
+ }
9004
+ }
9005
+ } catch (err) {
9006
+ _iterator10.e(err);
9007
+ } finally {
9008
+ _iterator10.f();
9009
+ }
9010
+
9011
+ self.cellTree.tempSchema = Array(dataColumnLength).fill().map(function () {
9012
+ return {
9013
+ hidden: false
9014
+ };
9015
+ });
9016
+ if (invalidColumnTree) self.cellTree.columns = {};
9017
+ }
9018
+
9019
+ self.cellTree.origin = {
9020
+ rows: self.cellTree.rows,
9021
+ columns: self.cellTree.columns
9022
+ };
9023
+ };
9024
+
9025
+ self.unhideColumns = function (orderIndex0, orderIndex1) {
9026
+ var orders = self.orders.columns;
9027
+ var schema = self.getSchema();
9028
+
9029
+ for (var i = orderIndex0; i <= orderIndex1; i++) {
9030
+ var columnIndex = orders[i];
9031
+ var s = schema[columnIndex];
9032
+ if (s && s.hidden) s.hidden = false;
9033
+ }
9034
+
9035
+ self.refresh();
9036
+ };
9037
+
9038
+ self.getDomRoot = function () {
9039
+ return self.shadowRoot ? self.shadowRoot.host : self.parentNode;
9040
+ };
9041
+
9042
+ self.getFontName = function (fontStyle) {
9043
+ return fontStyle.replace(/\d+\.?\d*px/, '');
9044
+ };
9045
+
9046
+ self.getFontHeight = function (fontStyle) {
9047
+ return parseFloat(fontStyle, 10);
9048
+ };
9049
+
9050
+ self.parseStyleValue = function (key) {
9051
+ if (/Font/.test(key)) {
9052
+ self.style[key + 'Height'] = self.getFontHeight(self.style[key]);
9053
+ self.style[key + 'Name'] = self.getFontName(self.style[key]);
9054
+ return;
9055
+ } // when inheriting styles from already instantiated grids, don't parse already parsed values.
9056
+
9057
+
9058
+ if (key === 'moveOverlayBorderSegments' && typeof self.style[key] === 'string') {
9059
+ self.style[key] = self.style[key].split(',').map(function (i) {
9060
+ return parseInt(i, 10);
9061
+ });
9062
+ }
9063
+ };
9064
+
9065
+ self.initProp = function (propName) {
9066
+ if (!self.args[propName]) {
9067
+ return;
9068
+ }
9069
+
9070
+ Object.keys(self.args[propName]).forEach(function (key) {
9071
+ self[propName][key] = self.args[propName][key];
9072
+ });
9073
+ };
9074
+
9075
+ self.getStyleProperty = function (key) {
9076
+ if (self.styleKeys.indexOf(key) === -1) {
9077
+ return self.parentNodeStyle[key];
9078
+ }
6864
9079
 
6865
9080
  return self.style[key];
6866
9081
  };
@@ -7000,6 +9215,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7000
9215
  self.intf.gotoCell = self.gotoCell;
7001
9216
  self.intf.gotoRow = self.gotoRow;
7002
9217
  self.intf.addButton = self.addButton;
9218
+ self.intf.toggleCellCollapseTree = self.toggleCellCollapseTree;
9219
+ self.intf.expandCollapseCellTree = self.expandCollapseCellTree;
7003
9220
  self.intf.getHeaderByName = self.getHeaderByName;
7004
9221
  self.intf.findColumnScrollLeft = self.findColumnScrollLeft;
7005
9222
  self.intf.findRowScrollTop = self.findRowScrollTop;
@@ -7007,6 +9224,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7007
9224
  self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;
7008
9225
  self.intf.disposeContextMenu = self.disposeContextMenu;
7009
9226
  self.intf.getCellAt = self.getCellAt;
9227
+ self.intf.groupColumns = self.groupColumns;
9228
+ self.intf.groupRows = self.groupRows;
9229
+ self.intf.removeGroupColumns = self.removeGroupColumns;
9230
+ self.intf.removeGroupRows = self.removeGroupRows;
9231
+ self.intf.toggleGroupColumns = self.toggleGroupColumns;
9232
+ self.intf.toggleGroupRows = self.toggleGroupRows;
9233
+ self.intf.getGroupsColumnBelongsTo = self.getGroupsColumnBelongsTo;
9234
+ self.intf.getGroupsRowBelongsTo = self.getGroupsRowBelongsTo;
7010
9235
  self.intf.isCellVisible = self.isCellVisible;
7011
9236
  self.intf.isRowVisible = self.isRowVisible;
7012
9237
  self.intf.isColumnVisible = self.isColumnVisible;
@@ -7049,6 +9274,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7049
9274
  self.intf.cut = self.cut;
7050
9275
  self.intf.paste = self.paste;
7051
9276
  self.intf.setStyleProperty = self.setStyleProperty;
9277
+ self.intf.hideColumns = self.hideColumns;
9278
+ self.intf.hideRows = self.hideRows;
9279
+ self.intf.unhideRows = self.unhideRows;
7052
9280
  Object.defineProperty(self.intf, 'defaults', {
7053
9281
  get: function get() {
7054
9282
  return {
@@ -7137,6 +9365,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7137
9365
  self.tryLoadStoredSettings();
7138
9366
  }
7139
9367
 
9368
+ if (key === 'rowTree' || key === 'columnTree' || key === 'columnTreeRowEndIndex') {
9369
+ self.initCellTreeSettings();
9370
+ }
9371
+
7140
9372
  self.draw(true);
7141
9373
  self.dispatchEvent('attributechanged', {
7142
9374
  name: key,
@@ -7771,6 +10003,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7771
10003
  self.dispatchEvent('datachanged', {
7772
10004
  data: self.originalData
7773
10005
  });
10006
+ self.initCellTreeSettings();
7774
10007
  self.resize(true);
7775
10008
  });
7776
10009
  }
@@ -8107,7 +10340,7 @@ function canvasDatagrid(args) {
8107
10340
  /*! namespace exports */
8108
10341
  /*! export default [provided] [no usage info] [missing usage info prevents renaming] */
8109
10342
  /*! other exports [not provided] [no usage info] */
8110
- /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
10343
+ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
8111
10344
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8112
10345
 
8113
10346
  "use strict";
@@ -8115,11 +10348,19 @@ __webpack_require__.r(__webpack_exports__);
8115
10348
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8116
10349
  /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
8117
10350
  /* harmony export */ });
10351
+ /* harmony import */ var _groups_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./groups/util */ "./lib/groups/util.js");
8118
10352
  /*jslint browser: true, unparam: true, todo: true*/
8119
10353
 
8120
10354
  /*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
8121
10355
 
8122
10356
 
10357
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
10358
+
10359
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10360
+
10361
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10362
+
10363
+
8123
10364
  /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
8124
10365
  /**
8125
10366
  * Converts a integer into a letter A - ZZZZZ...
@@ -8466,6 +10707,62 @@ __webpack_require__.r(__webpack_exports__);
8466
10707
  left: cells[0].x + cells[0].width + offset.x
8467
10708
  }, items, imgSrc);
8468
10709
  };
10710
+ /**
10711
+ * Expand/Collapse CellTree.
10712
+ * @memberof canvasDatagrid
10713
+ * @name toggleCellCollapseTree
10714
+ * @method
10715
+ * @param {array} treeData The array of cellTree to expand or collapse.
10716
+ */
10717
+
10718
+
10719
+ self.toggleCellCollapseTree = function (treeData) {
10720
+ for (var type in treeData) {
10721
+ var _iterator = _createForOfIteratorHelper(treeData[type]),
10722
+ _step;
10723
+
10724
+ try {
10725
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
10726
+ var t = _step.value;
10727
+ if (t.length > 0) self.toggleCollapseTree(t[0], t[1], type);
10728
+ }
10729
+ } catch (err) {
10730
+ _iterator.e(err);
10731
+ } finally {
10732
+ _iterator.f();
10733
+ }
10734
+ }
10735
+
10736
+ self.draw();
10737
+ };
10738
+ /**
10739
+ * Expand/Collapse CellTree.
10740
+ * @memberof canvasDatagrid
10741
+ * @name expandCollapseCellTree
10742
+ * @method
10743
+ * @param {array} treeData The array of cellTree to expand or collapse.
10744
+ */
10745
+
10746
+
10747
+ self.expandCollapseCellTree = function (treeData) {
10748
+ for (var type in treeData) {
10749
+ var _iterator2 = _createForOfIteratorHelper(treeData[type]),
10750
+ _step2;
10751
+
10752
+ try {
10753
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
10754
+ var t = _step2.value;
10755
+ if (t.length > 0) self.cellTreeExpandCollapse(t[0], t[1], type);
10756
+ }
10757
+ } catch (err) {
10758
+ _iterator2.e(err);
10759
+ } finally {
10760
+ _iterator2.f();
10761
+ }
10762
+ }
10763
+
10764
+ self.draw();
10765
+ };
8469
10766
  /**
8470
10767
  * Scrolls the cell at cell x, row y into view if it is not already.
8471
10768
  * @memberof canvasDatagrid
@@ -8902,6 +11199,64 @@ __webpack_require__.r(__webpack_exports__);
8902
11199
  }
8903
11200
  }
8904
11201
  };
11202
+ /**
11203
+ * Hide column/columns
11204
+ * @memberof canvasDatagrid
11205
+ * @name hideColumns
11206
+ * @param {number} beginColumnOrderIndex
11207
+ * @param {number} [endColumnOrderIndex]
11208
+ */
11209
+
11210
+
11211
+ self.hideColumns = function (beginColumnOrderIndex, endColumnOrderIndex) {
11212
+ var schema = self.getSchema();
11213
+ var orders = self.orders.columns;
11214
+ var count = 0;
11215
+ if (typeof endColumnOrderIndex !== 'number') endColumnOrderIndex = beginColumnOrderIndex;
11216
+
11217
+ for (var orderIndex = beginColumnOrderIndex; orderIndex <= endColumnOrderIndex; orderIndex++) {
11218
+ var columnIndex = orders[orderIndex];
11219
+
11220
+ if (columnIndex >= 0 && !schema[columnIndex].hidden) {
11221
+ count++;
11222
+ schema[columnIndex].hidden = true;
11223
+ }
11224
+ }
11225
+
11226
+ if (count > 0) {
11227
+ self.setStorageData();
11228
+ setTimeout(function () {
11229
+ self.resize(true);
11230
+ }, 10);
11231
+ }
11232
+ };
11233
+ /**
11234
+ * Hide rows
11235
+ * @memberof canvasDatagrid
11236
+ * @name hideRows
11237
+ * @param {number} beginRowIndex
11238
+ * @param {number} endRowIndex
11239
+ */
11240
+
11241
+
11242
+ self.hideRows = function (beginRowIndex, endRowIndex) {
11243
+ if ((0,_groups_util__WEBPACK_IMPORTED_MODULE_0__.mergeHiddenRowRanges)(self.hiddenRowRanges, [beginRowIndex, endRowIndex])) self.refresh();
11244
+ };
11245
+ /**
11246
+ * Unhide rows
11247
+ * @memberof canvasDatagrid
11248
+ * @name unhideRows
11249
+ * @param {number} beginRowIndex
11250
+ * @param {number} endRowIndex
11251
+ */
11252
+
11253
+
11254
+ self.unhideRows = function (beginRowIndex, endRowIndex) {
11255
+ self.hiddenRowRanges = self.hiddenRowRanges.filter(function (range) {
11256
+ return range[0] !== beginRowIndex || range[1] !== endRowIndex;
11257
+ });
11258
+ self.refresh();
11259
+ };
8905
11260
  /**
8906
11261
  * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.
8907
11262
  * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).
@@ -9017,6 +11372,315 @@ __webpack_require__.r(__webpack_exports__);
9017
11372
 
9018
11373
  self.setStorageData();
9019
11374
  };
11375
+ /**
11376
+ * Add grouping
11377
+ * @param {'columns'|'rows'} groupFor
11378
+ * @param {number} from
11379
+ * @param {number} to
11380
+ */
11381
+
11382
+
11383
+ function addGroup(groupFor, from, to) {
11384
+ var newRow = false;
11385
+ var allGroups = groupFor === 'rows' ? self.groupedRows : self.groupedColumns;
11386
+
11387
+ for (var i = allGroups.length - 1; i >= 0; i--) {
11388
+ var groups = allGroups[i];
11389
+ var min = groups[0].from,
11390
+ max = groups[groups.length - 1].to;
11391
+
11392
+ if (from <= min && to >= max) {
11393
+ if (from === min && to === max && groups.length === 1) return; // nothings happened
11394
+ // new group wrap this row
11395
+
11396
+ continue;
11397
+ }
11398
+
11399
+ for (var gi = 0; gi < groups.length; gi++) {
11400
+ var g = groups[gi];
11401
+ if (from > g.to) continue;
11402
+
11403
+ if (from >= g.from) {
11404
+ if (to > g.to) {
11405
+ if (from === g.from) {
11406
+ allGroups.splice(i, 0, [{
11407
+ from: from,
11408
+ to: to,
11409
+ collapsed: false
11410
+ }]);
11411
+ self.refresh();
11412
+ return;
11413
+ }
11414
+
11415
+ throw new Error("Can't group these ".concat(groupFor));
11416
+ }
11417
+
11418
+ if (to === g.to) {
11419
+ if (from === g.from) return; // nothings happened
11420
+ }
11421
+
11422
+ newRow = true;
11423
+ break;
11424
+ }
11425
+
11426
+ if (to >= g.from) {
11427
+ if (to < g.to) throw new Error("Can't group these ".concat(groupFor));
11428
+ allGroups.splice(i, 0, [{
11429
+ from: from,
11430
+ to: to,
11431
+ collapsed: false
11432
+ }]);
11433
+ } else {
11434
+ groups.splice(gi, 0, {
11435
+ from: from,
11436
+ to: to,
11437
+ collapsed: false
11438
+ });
11439
+ }
11440
+
11441
+ self.refresh();
11442
+ return;
11443
+ }
11444
+
11445
+ if (newRow) continue;
11446
+ groups.push({
11447
+ from: from,
11448
+ to: to,
11449
+ collapsed: false
11450
+ });
11451
+ self.refresh();
11452
+ return;
11453
+ }
11454
+
11455
+ if (newRow) allGroups.push([{
11456
+ from: from,
11457
+ to: to,
11458
+ collapsed: false
11459
+ }]);else allGroups.unshift([{
11460
+ from: from,
11461
+ to: to,
11462
+ collapsed: false
11463
+ }]);
11464
+ self.refresh();
11465
+ }
11466
+ /**
11467
+ * Remove grouping
11468
+ * @param {Array<Array<{from:number,to:number,collapsed:boolean}>>} allGroups
11469
+ * @param {number} from
11470
+ * @param {number} to
11471
+ */
11472
+
11473
+
11474
+ function removeGroup(allGroups, from, to) {
11475
+ for (var i = 0; i < allGroups.length; i++) {
11476
+ var groups = allGroups[i];
11477
+
11478
+ for (var gi = 0; gi < groups.length; gi++) {
11479
+ var group = groups[gi];
11480
+
11481
+ if (group.from === from && group.to === to) {
11482
+ if (groups.length <= 1) allGroups.splice(i, 1);else groups.splice(gi, 1);
11483
+ self.refresh();
11484
+ return;
11485
+ }
11486
+ }
11487
+ }
11488
+ }
11489
+ /**
11490
+ * Grouping columns
11491
+ * @memberof canvasDatagrid
11492
+ * @name groupColumns
11493
+ * @method
11494
+ * @param {number|string} firstColumnName Name of the first column to be grouped.
11495
+ * @param {number|string} lastColumnName Name of the last column to be grouped.
11496
+ */
11497
+
11498
+
11499
+ self.groupColumns = function (firstColumnName, lastColumnName) {
11500
+ /** @type {Array<{name: string,columnIndex:number}>} */
11501
+ var schema = self.getSchema();
11502
+ var firstOne, lastOne;
11503
+
11504
+ for (var i = 0; i < schema.length; i++) {
11505
+ var it = schema[i];
11506
+ if (firstOne && lastOne) break;
11507
+
11508
+ if (it.name === firstColumnName) {
11509
+ firstOne = it;
11510
+ continue;
11511
+ }
11512
+
11513
+ if (it.name === lastColumnName) {
11514
+ lastOne = it;
11515
+ continue;
11516
+ }
11517
+ }
11518
+
11519
+ if (!firstOne) throw new Error("No such column name for first column");
11520
+ if (!lastOne) throw new Error("No such column name for last column");
11521
+ if (lastOne.columnIndex > firstOne.columnIndex !== true) throw new Error("Can't group these columns");
11522
+ var from = firstOne.columnIndex;
11523
+ var to = lastOne.columnIndex;
11524
+ var ev = {
11525
+ group: {
11526
+ type: 'columns',
11527
+ from: from,
11528
+ to: to
11529
+ }
11530
+ };
11531
+
11532
+ try {
11533
+ addGroup('columns', from, to);
11534
+ } catch (error) {
11535
+ ev.error = error;
11536
+ }
11537
+
11538
+ self.dispatchEvent('aftercreategroup', ev);
11539
+ };
11540
+ /**
11541
+ * Grouping columns
11542
+ * @memberof canvasDatagrid
11543
+ * @name groupRows
11544
+ * @method
11545
+ * @param {number} rowIndexFrom The row index which is the beginning of the group
11546
+ * @param {number} rowIndexTo The row index which is the end of the group
11547
+ */
11548
+
11549
+
11550
+ self.groupRows = function (rowIndexFrom, rowIndexTo) {
11551
+ if (!Number.isInteger(rowIndexFrom) || rowIndexFrom < 0) throw new Error("No such row for the beginning of the group");
11552
+ var dataLength = self.viewData.length;
11553
+ if (!Number.isInteger(rowIndexFrom) || rowIndexTo <= rowIndexFrom || rowIndexTo >= dataLength) throw new Error("No such row for the end of the group");
11554
+ var ev = {
11555
+ group: {
11556
+ type: 'rows',
11557
+ from: rowIndexFrom,
11558
+ to: rowIndexTo
11559
+ }
11560
+ };
11561
+
11562
+ try {
11563
+ addGroup('rows', rowIndexFrom, rowIndexTo);
11564
+ } catch (error) {
11565
+ ev.error = error;
11566
+ }
11567
+
11568
+ self.dispatchEvent('aftercreategroup', ev);
11569
+ };
11570
+ /**
11571
+ * Remove grouping columns
11572
+ * @memberof canvasDatagrid
11573
+ * @name removeGroupColumns
11574
+ * @method
11575
+ * @param {number|string} firstColumnName Name of the first column to be grouped.
11576
+ * @param {number|string} lastColumnName Name of the last column to be grouped.
11577
+ */
11578
+
11579
+
11580
+ self.removeGroupColumns = function (firstColumnName, lastColumnName) {
11581
+ /** @type {Array<{name:string,columnIndex:number}>} */
11582
+ var schema = self.getSchema();
11583
+ var firstOne, lastOne;
11584
+
11585
+ for (var i = 0; i < schema.length; i++) {
11586
+ var it = schema[i];
11587
+ if (firstOne && lastOne) break;
11588
+
11589
+ if (it.name === firstColumnName) {
11590
+ firstOne = it;
11591
+ continue;
11592
+ }
11593
+
11594
+ if (it.name === lastColumnName) {
11595
+ lastOne = it;
11596
+ continue;
11597
+ }
11598
+ }
11599
+
11600
+ if (!firstOne) throw new Error("No such column name for first column");
11601
+ if (!lastOne) throw new Error("No such column name for last column");
11602
+ var from = firstOne.columnIndex;
11603
+ var to = lastOne.columnIndex;
11604
+ removeGroup(self.groupedColumns, from, to);
11605
+ };
11606
+ /**
11607
+ * Remove grouping columns
11608
+ * @memberof canvasDatagrid
11609
+ * @name removeGroupRows
11610
+ * @method
11611
+ * @param {number} rowIndexFrom The row index which is the beginning of the group
11612
+ * @param {number} rowIndexTo The row index which is the end of the group
11613
+ */
11614
+
11615
+
11616
+ self.removeGroupRows = function (rowIndexFrom, rowIndexTo) {
11617
+ removeGroup(self.groupedRows, rowIndexFrom, rowIndexTo);
11618
+ };
11619
+ /**
11620
+ * Toggle(expand/collapsed) grouping columns
11621
+ * @memberof canvasDatagrid
11622
+ * @name toggleGroupColumns
11623
+ * @method
11624
+ * @param {number|string} firstColumnName Name of the first column to be grouped.
11625
+ * @param {number|string} lastColumnName Name of the last column to be grouped.
11626
+ */
11627
+
11628
+
11629
+ self.toggleGroupColumns = function (firstColumnName, lastColumnName) {
11630
+ /** @type {Array<{name:string,columnIndex:number}>} */
11631
+ var schema = self.getSchema();
11632
+ var firstOne, lastOne;
11633
+
11634
+ for (var i = 0; i < schema.length; i++) {
11635
+ var it = schema[i];
11636
+ if (firstOne && lastOne) break;
11637
+
11638
+ if (it.name === firstColumnName) {
11639
+ firstOne = it;
11640
+ continue;
11641
+ }
11642
+
11643
+ if (it.name === lastColumnName) {
11644
+ lastOne = it;
11645
+ continue;
11646
+ }
11647
+ }
11648
+
11649
+ if (!firstOne || !lastOne) return;
11650
+ var from = firstOne.columnIndex;
11651
+ var to = lastOne.columnIndex;
11652
+
11653
+ if (self.toggleGroup({
11654
+ type: 'c',
11655
+ from: from,
11656
+ to: to
11657
+ })) {
11658
+ self.disposeContextMenu();
11659
+ self.setStorageData();
11660
+ self.refresh();
11661
+ }
11662
+ };
11663
+ /**
11664
+ * Toggle(expand/collapsed) grouping rows
11665
+ * @memberof canvasDatagrid
11666
+ * @name toggleGroupRows
11667
+ * @method
11668
+ * @param {number} rowIndexFrom The row index which is the beginning of the group
11669
+ * @param {number} rowIndexTo The row index which is the end of the group
11670
+ */
11671
+
11672
+
11673
+ self.toggleGroupRows = function (rowIndexFrom, rowIndexTo) {
11674
+ if (self.toggleGroup({
11675
+ type: 'r',
11676
+ from: rowIndexFrom,
11677
+ to: rowIndexTo
11678
+ })) {
11679
+ self.disposeContextMenu();
11680
+ self.setStorageData();
11681
+ self.refresh();
11682
+ }
11683
+ };
9020
11684
 
9021
11685
  self.isInGrid = function (e) {
9022
11686
  if (e.x < 0 || e.x > self.width || e.y < 0 || e.y > self.height) {
@@ -9107,6 +11771,10 @@ __webpack_require__.r(__webpack_exports__);
9107
11771
  } // TODO:
9108
11772
 
9109
11773
 
11774
+ if (!self.data) {
11775
+ self.data = {};
11776
+ }
11777
+
9110
11778
  if (!self.data[rowIndex]) {
9111
11779
  self.data[rowIndex] = {};
9112
11780
  } // TODO:
@@ -9145,6 +11813,64 @@ __webpack_require__.r(__webpack_exports__);
9145
11813
  });
9146
11814
  });
9147
11815
  };
11816
+ /**
11817
+ * Get the column group info given column belongs to
11818
+ * @memberof canvasDatagrid
11819
+ * @name getGroupsColumnBelongsTo
11820
+ * @method
11821
+ * @param {number} columnIndex Column index.
11822
+ * @returns {Array<{from:number,to:number,collapsed:boolean}>}
11823
+ */
11824
+
11825
+
11826
+ self.getGroupsColumnBelongsTo = function (columnIndex) {
11827
+ if (!self.attributes.allowGroupingColumns) return [];
11828
+ var result = [];
11829
+
11830
+ for (var i = 0; i < self.groupedColumns.length; i++) {
11831
+ var groups = self.groupedColumns[i];
11832
+
11833
+ for (var j = 0; j < groups.length; j++) {
11834
+ var group = groups[j];
11835
+
11836
+ if (columnIndex >= group.from && columnIndex <= group.to) {
11837
+ result.push(group);
11838
+ break;
11839
+ }
11840
+ }
11841
+ }
11842
+
11843
+ return result;
11844
+ };
11845
+ /**
11846
+ * Get the row group info given row belongs to
11847
+ * @memberof canvasDatagrid
11848
+ * @name getGroupsRowBelongsTo
11849
+ * @method
11850
+ * @param {number} rowIndex Row index.
11851
+ * @returns {Array<{from:number,to:number,collapsed:boolean}>}
11852
+ */
11853
+
11854
+
11855
+ self.getGroupsRowBelongsTo = function (rowIndex) {
11856
+ if (!self.attributes.allowGroupingRows) return [];
11857
+ var result = [];
11858
+
11859
+ for (var i = 0; i < self.groupedRows.length; i++) {
11860
+ var groups = self.groupedRows[i];
11861
+
11862
+ for (var j = 0; j < groups.length; j++) {
11863
+ var group = groups[j];
11864
+
11865
+ if (rowIndex >= group.from && rowIndex <= group.to) {
11866
+ result.push(group);
11867
+ break;
11868
+ }
11869
+ }
11870
+ }
11871
+
11872
+ return result;
11873
+ };
9148
11874
  /**
9149
11875
  * Checks if a given column is visible.
9150
11876
  * @memberof canvasDatagrid
@@ -9191,6 +11917,69 @@ __webpack_require__.r(__webpack_exports__);
9191
11917
  return c.columnIndex === x && c.rowIndex === y;
9192
11918
  })[0];
9193
11919
  };
11920
+ /**
11921
+ * Get an unhide indicator at grid pixel coordinate x and y.
11922
+ * @memberof canvasDatagrid
11923
+ * @name getUnhideIndicator
11924
+ * @method
11925
+ * @param {number} x Number of pixels from the left.
11926
+ * @param {number} y Number of pixels from the top.
11927
+ */
11928
+
11929
+
11930
+ self.getUnhideIndicator = function (x, y) {
11931
+ var indicators = self.visibleUnhideIndicators;
11932
+ if (indicators.length <= 0) return;
11933
+
11934
+ for (var i = 0; i < indicators.length; i++) {
11935
+ var indicator = indicators[i];
11936
+ if (x >= indicator.x && y >= indicator.y && x <= indicator.x2 && y <= indicator.y2) return indicator;
11937
+ }
11938
+ };
11939
+ /**
11940
+ * Get a column group at grid pixel coordinate x and y.
11941
+ * @memberof canvasDatagrid
11942
+ * @name getColumnGroupAt
11943
+ * @method
11944
+ * @param {number} x Number of pixels from the left.
11945
+ * @param {number} y Number of pixels from the top.
11946
+ */
11947
+
11948
+
11949
+ self.getColumnGroupAt = function (x, y) {
11950
+ var groups = self.groupedColumns.length;
11951
+ if (groups <= 0) return;
11952
+ var yZero = self.getColumnGroupAreaHeight();
11953
+ if (y >= yZero) return;
11954
+
11955
+ for (var i = 0; i < self.visibleGroups.length; i++) {
11956
+ var g = self.visibleGroups[i];
11957
+ if (g.type !== 'c') continue;
11958
+ if (x >= g.x && y >= g.y && x <= g.x2 && y <= g.y2) return g;
11959
+ }
11960
+ };
11961
+ /**
11962
+ * Get a row group at grid pixel coordinate x and y.
11963
+ * @memberof canvasDatagrid
11964
+ * @name getRowGroupAt
11965
+ * @method
11966
+ * @param {number} x Number of pixels from the left.
11967
+ * @param {number} y Number of pixels from the top.
11968
+ */
11969
+
11970
+
11971
+ self.getRowGroupAt = function (x, y) {
11972
+ var groups = self.groupedRows.length;
11973
+ if (groups <= 0) return;
11974
+ var xZero = self.getRowGroupAreaWidth();
11975
+ if (x >= xZero) return;
11976
+
11977
+ for (var i = 0; i < self.visibleGroups.length; i++) {
11978
+ var g = self.visibleGroups[i];
11979
+ if (g.type !== 'r') continue;
11980
+ if (x >= g.x && y >= g.y && x <= g.x2 && y <= g.y2) return g;
11981
+ }
11982
+ };
9194
11983
  /**
9195
11984
  * Gets the cell at grid pixel coordinate x and y. Author's note. This function ties drawing and events together. This is a very complex function and is core to the component.
9196
11985
  * @memberof canvasDatagrid
@@ -9225,6 +12014,8 @@ __webpack_require__.r(__webpack_exports__);
9225
12014
  return;
9226
12015
  }
9227
12016
 
12017
+ x -= self.getRowGroupAreaWidth();
12018
+ y -= self.getColumnGroupAreaHeight();
9228
12019
  var border,
9229
12020
  tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0,
9230
12021
  moveMode = self.attributes.borderDragBehavior === 'move',
@@ -9355,8 +12146,14 @@ __webpack_require__.r(__webpack_exports__);
9355
12146
  }
9356
12147
 
9357
12148
  if (cell.style === 'columnHeaderCell') {
9358
- cell.context = 'cell';
9359
- cell.dragContext = 'column-reorder';
12149
+ if (cell.x + cell.width - self.attributes.columnGrabZoneSize - self.style.cellBorderWidth > x || !self.attributes.allowRowReordering) {
12150
+ cell.dragContext = 'cell';
12151
+ cell.context = 'cell';
12152
+ } else {
12153
+ cell.context = self.cursorGrab;
12154
+ cell.dragContext = 'column-reorder';
12155
+ }
12156
+
9360
12157
  return cell;
9361
12158
  }
9362
12159
 
@@ -9551,7 +12348,7 @@ __webpack_require__.r(__webpack_exports__);
9551
12348
  }
9552
12349
 
9553
12350
  self.ctx.font = self.style.columnHeaderCellFont;
9554
- var t = self.ctx.measureText(col.title || col.name).width + self.style.headerCellPaddingRight + self.style.headerCellPaddingLeft;
12351
+ var t = self.ctx.measureText(col.title || col.name).width + self.style.columnHeaderCellPaddingRight + self.style.columnHeaderCellPaddingLeft + self.style.cellAutoResizePadding;
9555
12352
  m = t > m ? t : m;
9556
12353
  formatter = self.formatters[col.type];
9557
12354
  });