canvas-datagrid 0.4.2 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/canvas-datagrid.debug.js +1567 -326
- package/dist/canvas-datagrid.debug.map +1 -1
- package/dist/canvas-datagrid.js +1 -1
- package/dist/canvas-datagrid.module.js +1 -1
- package/dist/canvas-datagrid.module.js.map +1 -1
- package/dist/types.d.ts +59 -6
- package/lib/contextMenu.js +178 -49
- package/lib/defaults.js +21 -7
- package/lib/docs.js +48 -1
- package/lib/dom.js +29 -2
- package/lib/draw.js +497 -84
- package/lib/events/index.js +650 -161
- package/lib/groups/util.js +42 -0
- package/lib/intf.js +43 -3
- package/lib/main.js +1 -0
- package/lib/publicMethods.js +199 -41
- package/package.json +2 -2
|
@@ -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) {
|
|
@@ -1221,17 +1344,30 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1221
1344
|
// columnIndex: columnOrderIndex,
|
|
1222
1345
|
var columnOrderIndex = e.cell.columnIndex;
|
|
1223
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
|
+
|
|
1224
1359
|
e.items.push({
|
|
1225
|
-
title: self.attributes.hideColumnText.replace(/%s/gi,
|
|
1360
|
+
title: self.attributes.hideColumnText.replace(/%s/gi, title),
|
|
1226
1361
|
click: function click(ev) {
|
|
1227
|
-
self.getSchema()[columnIndex].hidden = true;
|
|
1228
1362
|
ev.preventDefault();
|
|
1229
1363
|
self.stopPropagation(ev);
|
|
1230
1364
|
self.disposeContextMenu();
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
self.
|
|
1234
|
-
}
|
|
1365
|
+
|
|
1366
|
+
if (contiguousColumns) {
|
|
1367
|
+
self.hideColumns(contiguousColumns[0].orderIndex, contiguousColumns[1].orderIndex);
|
|
1368
|
+
} else {
|
|
1369
|
+
self.hideColumns(columnOrderIndex);
|
|
1370
|
+
}
|
|
1235
1371
|
}
|
|
1236
1372
|
});
|
|
1237
1373
|
}
|
|
@@ -1279,7 +1415,50 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1279
1415
|
self.controlInput.focus();
|
|
1280
1416
|
}
|
|
1281
1417
|
});
|
|
1282
|
-
} //#region
|
|
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
|
|
1283
1462
|
|
|
1284
1463
|
|
|
1285
1464
|
var groupAreaHeight = self.getColumnGroupAreaHeight();
|
|
@@ -1352,31 +1531,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1352
1531
|
|
|
1353
1532
|
var canGroupByColumns = self.attributes.allowGroupingColumns && e.cell.isColumnHeader && e.cell.header && e.cell.header.index > 0;
|
|
1354
1533
|
var canUngroupColumns = self.attributes.allowGroupingColumns && e.cell.isColumnHeader;
|
|
1355
|
-
var canGroupByRows = self.attributes.allowGroupingRows && e.cell.isRowHeader && e.cell.header;
|
|
1534
|
+
var canGroupByRows = !isSorting && self.attributes.allowGroupingRows && e.cell.isRowHeader && e.cell.header;
|
|
1356
1535
|
var canUngroupRows = self.attributes.allowGroupingRows && e.cell.isRowHeader;
|
|
1357
|
-
/**
|
|
1358
|
-
* The value for storing the return value from `self.getSchema()`
|
|
1359
|
-
* @type {any[]}
|
|
1360
|
-
*/
|
|
1361
|
-
|
|
1362
|
-
var schema;
|
|
1363
|
-
/**
|
|
1364
|
-
* A map between columnIndex and column data
|
|
1365
|
-
* @type {Map<string,any>}
|
|
1366
|
-
*/
|
|
1367
|
-
|
|
1368
|
-
var columns;
|
|
1369
|
-
|
|
1370
|
-
var getColumnsMap = function getColumnsMap() {
|
|
1371
|
-
if (!columns) {
|
|
1372
|
-
if (!schema) schema = self.getSchema();
|
|
1373
|
-
columns = new Map(schema.map(function (_col) {
|
|
1374
|
-
return [_col.columnIndex, _col];
|
|
1375
|
-
}));
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
return columns;
|
|
1379
|
-
};
|
|
1380
1536
|
|
|
1381
1537
|
if (canGroupByColumns) {
|
|
1382
1538
|
/** @type {number[]} */
|
|
@@ -1405,11 +1561,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1405
1561
|
for (var i = 0; i < groupIndexes.length; i++) {
|
|
1406
1562
|
var _columnIndex = groupIndexes[i];
|
|
1407
1563
|
|
|
1408
|
-
var
|
|
1564
|
+
var _column = _columns.get(_columnIndex);
|
|
1409
1565
|
|
|
1410
|
-
if (
|
|
1411
|
-
groupNames.push(
|
|
1412
|
-
groupTitles.push(
|
|
1566
|
+
if (_column) {
|
|
1567
|
+
groupNames.push(_column.name);
|
|
1568
|
+
groupTitles.push(_column.title || _column.name || _column.index);
|
|
1413
1569
|
}
|
|
1414
1570
|
}
|
|
1415
1571
|
|
|
@@ -1433,8 +1589,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1433
1589
|
|
|
1434
1590
|
var _columns2 = getColumnsMap();
|
|
1435
1591
|
|
|
1436
|
-
var _loop = function _loop(
|
|
1437
|
-
var _groups$_i = groups[
|
|
1592
|
+
var _loop = function _loop(_i2) {
|
|
1593
|
+
var _groups$_i = groups[_i2],
|
|
1438
1594
|
from = _groups$_i.from,
|
|
1439
1595
|
to = _groups$_i.to;
|
|
1440
1596
|
|
|
@@ -1457,44 +1613,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1457
1613
|
}
|
|
1458
1614
|
};
|
|
1459
1615
|
|
|
1460
|
-
for (var
|
|
1461
|
-
_loop(
|
|
1616
|
+
for (var _i2 = 0; _i2 < groups.length; _i2++) {
|
|
1617
|
+
_loop(_i2);
|
|
1462
1618
|
}
|
|
1463
1619
|
}
|
|
1464
1620
|
|
|
1465
1621
|
if (canGroupByRows) {
|
|
1466
|
-
var
|
|
1467
|
-
var prev = -2;
|
|
1468
|
-
var ok = true;
|
|
1469
|
-
self.selections.forEach(function (row, index) {
|
|
1470
|
-
if (!ok) return;
|
|
1471
|
-
|
|
1472
|
-
if (prev < -1) {
|
|
1473
|
-
prev = index;
|
|
1474
|
-
range[0] = index;
|
|
1475
|
-
return;
|
|
1476
|
-
}
|
|
1622
|
+
var _range = getSelectedContiguousRows(false) || [];
|
|
1477
1623
|
|
|
1478
|
-
|
|
1479
|
-
ok = false;
|
|
1480
|
-
return;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
prev = index;
|
|
1484
|
-
range[1] = index;
|
|
1485
|
-
});
|
|
1486
|
-
var rangeTitle = range.map(function (rowIndex) {
|
|
1624
|
+
var rangeTitle = _range.map(function (rowIndex) {
|
|
1487
1625
|
var index = self.getBoundRowIndexFromViewRowIndex(rowIndex);
|
|
1488
1626
|
if (typeof index === 'number') return index + 1;
|
|
1489
1627
|
return rowIndex + 1;
|
|
1490
1628
|
}).join('-');
|
|
1491
1629
|
|
|
1492
|
-
if (
|
|
1630
|
+
if (_range.length === 2 && self.isNewGroupRangeValid(self.groupedRows, _range[0], _range[1])) {
|
|
1493
1631
|
e.items.push({
|
|
1494
1632
|
title: self.attributes.showGroupRows.replace('%s', rangeTitle),
|
|
1495
1633
|
click: function click(ev) {
|
|
1496
1634
|
ev.preventDefault();
|
|
1497
|
-
self.groupRows(
|
|
1635
|
+
self.groupRows(_range[0], _range[1]);
|
|
1498
1636
|
}
|
|
1499
1637
|
});
|
|
1500
1638
|
}
|
|
@@ -1505,8 +1643,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1505
1643
|
|
|
1506
1644
|
var _groups = self.getGroupsRowBelongsTo(rowIndex);
|
|
1507
1645
|
|
|
1508
|
-
var _loop2 = function _loop2(
|
|
1509
|
-
var _groups$_i2 = _groups[
|
|
1646
|
+
var _loop2 = function _loop2(_i3) {
|
|
1647
|
+
var _groups$_i2 = _groups[_i3],
|
|
1510
1648
|
from = _groups$_i2.from,
|
|
1511
1649
|
to = _groups$_i2.to;
|
|
1512
1650
|
var rangeTitle = [from, to].map(function (rowIndex) {
|
|
@@ -1524,8 +1662,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1524
1662
|
});
|
|
1525
1663
|
};
|
|
1526
1664
|
|
|
1527
|
-
for (var
|
|
1528
|
-
_loop2(
|
|
1665
|
+
for (var _i3 = 0; _i3 < _groups.length; _i3++) {
|
|
1666
|
+
_loop2(_i3);
|
|
1529
1667
|
}
|
|
1530
1668
|
} //#endregion group/ungroup columns
|
|
1531
1669
|
|
|
@@ -1617,7 +1755,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1617
1755
|
function createDisposeEvent() {
|
|
1618
1756
|
requestAnimationFrame(function () {
|
|
1619
1757
|
document.addEventListener('click', self.disposeContextMenu);
|
|
1620
|
-
|
|
1758
|
+
window.removeEventListener('mouseup', createDisposeEvent);
|
|
1621
1759
|
});
|
|
1622
1760
|
}
|
|
1623
1761
|
|
|
@@ -1665,7 +1803,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
1665
1803
|
self.contextMenu = createContextMenu(ev, contextPosition, items);
|
|
1666
1804
|
|
|
1667
1805
|
if (e.type == 'mousedown') {
|
|
1668
|
-
|
|
1806
|
+
window.addEventListener('mouseup', createDisposeEvent);
|
|
1669
1807
|
} else {
|
|
1670
1808
|
createDisposeEvent();
|
|
1671
1809
|
}
|
|
@@ -1701,10 +1839,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1701
1839
|
|
|
1702
1840
|
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
|
|
1703
1841
|
self.defaults = {
|
|
1704
|
-
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', ' '], ['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], ['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
|
|
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], ['allowShrinkingSelection', false], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearCellsWhenShrinkingSelection', false], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', ' '], ['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
|
|
1705
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
|
|
1706
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]],
|
|
1707
|
-
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', '▼'], ['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', '►'], ['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', '▼'], ['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', '▼'], ['contextMenuArrowUpHTML', '▲'], ['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], ['width', 'auto']]
|
|
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', '▼'], ['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', '►'], ['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', '▼'], ['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', '▼'], ['contextMenuArrowUpHTML', '▲'], ['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(165, 198, 254, 1)'], ['frozenMarkerHoverBorderColor', 'rgba(165, 198, 254, 1)'], ['frozenMarkerActiveColor', 'rgba(165, 198, 254, 0.2)'], ['frozenMarkerActiveBorderColor', 'rgba(165, 198, 254, 0.5)'], ['frozenMarkerActiveHeaderColor', 'rgba(165, 198, 254, 1)'], ['frozenMarkerColor', 'rgba(221, 221, 221, 1)'], ['frozenMarkerBorderColor', 'rgba(221, 221, 221, 1)'], ['frozenMarkerBorderWidth', 1], ['frozenMarkerHeaderColor', 'rgba(188, 188, 188, 1)'], ['frozenMarkerWidth', 4], ['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'], ['fillOverlayBorderColor', 'rgba(127, 127, 127, 1)'], ['fillOverlayBorderWidth', 2], ['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']]
|
|
1708
1846
|
};
|
|
1709
1847
|
}
|
|
1710
1848
|
|
|
@@ -2108,6 +2246,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2108
2246
|
var cellValueIsEmpty = [null, undefined].indexOf(cell.value) !== -1;
|
|
2109
2247
|
var shouldClearCellValue = cellValueIsEmpty || inEnterMode;
|
|
2110
2248
|
self.input.value = shouldClearCellValue ? '' : cell.value;
|
|
2249
|
+
var width = Math.round(self.input.value.length * parseInt(self.style.editCellFontSize, 10) * 0.7 * self.scale);
|
|
2250
|
+
|
|
2251
|
+
if (width + self.style.cellPaddingLeft < cell.width) {
|
|
2252
|
+
width = cell.width - self.style.cellPaddingLeft;
|
|
2253
|
+
} else if (width > self.width - cell.x - self.style.scrollBarWidth) {
|
|
2254
|
+
width = self.width - cell.x - self.style.scrollBarWidth;
|
|
2255
|
+
self.input.style.height = 'auto';
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
self.input.style.width = width + 'px';
|
|
2111
2259
|
self.input.focus();
|
|
2112
2260
|
self.input.addEventListener('click', self.stopPropagation);
|
|
2113
2261
|
self.input.addEventListener('dblclick', self.stopPropagation);
|
|
@@ -2191,6 +2339,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2191
2339
|
|
|
2192
2340
|
self.scrollIntoView(nx, ny);
|
|
2193
2341
|
self.beginEditAt(nx, ny, e);
|
|
2342
|
+
} else {
|
|
2343
|
+
var _width = Math.round(self.input.value.length * parseInt(self.style.editCellFontSize, 10) * 0.7 * self.scale);
|
|
2344
|
+
|
|
2345
|
+
if (_width + self.style.cellPaddingLeft < cell.width) {
|
|
2346
|
+
_width = cell.width - self.style.cellPaddingLeft;
|
|
2347
|
+
} else if (_width > self.width - cell.x - self.style.scrollBarWidth) {
|
|
2348
|
+
_width = self.width - cell.x - self.style.scrollBarWidth;
|
|
2349
|
+
self.input.style.height = 'auto';
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
self.input.style.width = _width + 'px';
|
|
2194
2353
|
}
|
|
2195
2354
|
});
|
|
2196
2355
|
self.dispatchEvent('beginedit', {
|
|
@@ -2521,11 +2680,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2521
2680
|
});
|
|
2522
2681
|
self.eventParent.addEventListener('scroll', self.resize, false);
|
|
2523
2682
|
self.eventParent.addEventListener('touchstart', self.touchstart, false);
|
|
2524
|
-
self.eventParent.addEventListener('mouseup', self.mouseup, false);
|
|
2525
2683
|
self.eventParent.addEventListener('mousedown', self.mousedown, false);
|
|
2526
2684
|
self.eventParent.addEventListener('dblclick', self.dblclick, false);
|
|
2527
2685
|
self.eventParent.addEventListener('click', self.click, false);
|
|
2528
|
-
|
|
2686
|
+
window.addEventListener('mouseup', self.mouseup, false);
|
|
2687
|
+
window.addEventListener('mousemove', self.mousemove);
|
|
2529
2688
|
self[self.isChildGrid ? 'parentGrid' : 'eventParent'].addEventListener('wheel', self.scrollWheel, false);
|
|
2530
2689
|
self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);
|
|
2531
2690
|
self.controlInput.addEventListener('copy', self.copy);
|
|
@@ -2560,6 +2719,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2560
2719
|
/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
|
|
2561
2720
|
|
|
2562
2721
|
|
|
2722
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2723
|
+
|
|
2724
|
+
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."); }
|
|
2725
|
+
|
|
2726
|
+
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; }
|
|
2727
|
+
|
|
2728
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2729
|
+
|
|
2563
2730
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2564
2731
|
|
|
2565
2732
|
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."); }
|
|
@@ -2675,10 +2842,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2675
2842
|
}
|
|
2676
2843
|
/**
|
|
2677
2844
|
* @param {number[]} coords [x0,y0, x1,y1, x2,y2, ...]
|
|
2845
|
+
* @param {boolean} [fill] fill the area that construct by these lines but not stroke
|
|
2678
2846
|
*/
|
|
2679
2847
|
|
|
2680
2848
|
|
|
2681
|
-
function
|
|
2849
|
+
function drawLines(coords, fill) {
|
|
2682
2850
|
if (coords.length < 4) return;
|
|
2683
2851
|
self.ctx.beginPath();
|
|
2684
2852
|
self.ctx.moveTo(coords[0] + self.canvasOffsetLeft, coords[1] + self.canvasOffsetTop);
|
|
@@ -2689,7 +2857,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2689
2857
|
self.ctx.lineTo(x, y);
|
|
2690
2858
|
}
|
|
2691
2859
|
|
|
2692
|
-
self.ctx.stroke();
|
|
2860
|
+
if (fill) self.ctx.fill();else self.ctx.stroke();
|
|
2693
2861
|
}
|
|
2694
2862
|
/**
|
|
2695
2863
|
* @param {number} x based-X (left-top)
|
|
@@ -2704,8 +2872,72 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2704
2872
|
strokeRect(x, y, width, width);
|
|
2705
2873
|
var cx = x + width * 0.5;
|
|
2706
2874
|
var cy = y + width * 0.5;
|
|
2707
|
-
|
|
2708
|
-
if (collapsed)
|
|
2875
|
+
drawLines([x + width * 0.2, cy, x + width * 0.78, cy]);
|
|
2876
|
+
if (collapsed) drawLines([cx, y + width * 0.22, cx, y + width * 0.8]);
|
|
2877
|
+
}
|
|
2878
|
+
/**
|
|
2879
|
+
* @param {number} x
|
|
2880
|
+
* @param {number} y
|
|
2881
|
+
* @param {number} size
|
|
2882
|
+
* @param {string} dir Direction of the triangle, one of the 't','b','l' and 'r'
|
|
2883
|
+
* @param {boolean} [active]
|
|
2884
|
+
*/
|
|
2885
|
+
|
|
2886
|
+
|
|
2887
|
+
function drawUnhideIndicator(x, y, size, dir, active) {
|
|
2888
|
+
var minPadding = size * 0.2;
|
|
2889
|
+
var maxPadding = size * 0.3;
|
|
2890
|
+
/** The long edge width of the triangle */
|
|
2891
|
+
|
|
2892
|
+
var longEdge = size - 2 * minPadding;
|
|
2893
|
+
/** The median width of the triangle */
|
|
2894
|
+
|
|
2895
|
+
var median = size - 2 * maxPadding;
|
|
2896
|
+
var halfLongEdge = longEdge * 0.5;
|
|
2897
|
+
var x0, y0;
|
|
2898
|
+
var coords, borderCoords;
|
|
2899
|
+
|
|
2900
|
+
switch (dir) {
|
|
2901
|
+
case 'r':
|
|
2902
|
+
x0 = x + maxPadding;
|
|
2903
|
+
y0 = y + minPadding;
|
|
2904
|
+
borderCoords = [x, y, x + size, y, x + size, y + size, x, y + size];
|
|
2905
|
+
coords = [x0, y0, x0, y0 + longEdge, x0 + median, y0 + halfLongEdge];
|
|
2906
|
+
break;
|
|
2907
|
+
|
|
2908
|
+
case 'l':
|
|
2909
|
+
x0 = x + size - maxPadding;
|
|
2910
|
+
y0 = y + minPadding;
|
|
2911
|
+
borderCoords = [x + size, y, x, y, x, y + size, x + size, y + size];
|
|
2912
|
+
coords = [x0, y0, x0, y0 + longEdge, x0 - median, y0 + halfLongEdge];
|
|
2913
|
+
break;
|
|
2914
|
+
|
|
2915
|
+
case 't':
|
|
2916
|
+
x0 = x + minPadding;
|
|
2917
|
+
y0 = y + size - maxPadding;
|
|
2918
|
+
borderCoords = [x, y + size, x, y, x + size, y, x + size, y + size];
|
|
2919
|
+
coords = [x0, y0, x0 + longEdge, y0, x0 + halfLongEdge, y0 - median];
|
|
2920
|
+
break;
|
|
2921
|
+
|
|
2922
|
+
case 'b':
|
|
2923
|
+
x0 = x + minPadding;
|
|
2924
|
+
y0 = y + maxPadding;
|
|
2925
|
+
borderCoords = [x, y, x, y + size, x + size, y + size, x + size, y];
|
|
2926
|
+
coords = [x0, y0, x0 + longEdge, y0, x0 + halfLongEdge, y0 + median];
|
|
2927
|
+
break;
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
if (active) {
|
|
2931
|
+
self.ctx.strokeStyle = self.style.unhideIndicatorBorderColor;
|
|
2932
|
+
self.ctx.lineWidth = 2;
|
|
2933
|
+
drawLines(borderCoords);
|
|
2934
|
+
self.ctx.fillStyle = self.style.unhideIndicatorBackgroundColor;
|
|
2935
|
+
var offset = dir === 'r' || dir === 'b' ? 1 : 0;
|
|
2936
|
+
if (dir === 'l' || dir === 'r') fillRect(x - offset, y, size + offset, size);else fillRect(x, y - offset, size, size + offset);
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
self.ctx.fillStyle = self.style.unhideIndicatorColor;
|
|
2940
|
+
drawLines(coords, true);
|
|
2709
2941
|
}
|
|
2710
2942
|
|
|
2711
2943
|
function drawOrderByArrow(x, y) {
|
|
@@ -3292,7 +3524,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3292
3524
|
columnGroupsRectInfo = {},
|
|
3293
3525
|
collapsedColumnGroups = self.getCollapsedColumnGroups(),
|
|
3294
3526
|
collapsedRowGroups = self.getCollapsedRowGroups(),
|
|
3295
|
-
cellHeight = self.style.cellHeight
|
|
3527
|
+
cellHeight = self.style.cellHeight,
|
|
3528
|
+
currentRowIndexOffset = 0,
|
|
3529
|
+
|
|
3530
|
+
/** @type {Array<{from:number,plus:number}>} */
|
|
3531
|
+
rowIndexOffsetByHiddenRows = self.hiddenRowRanges.map(function (range) {
|
|
3532
|
+
return {
|
|
3533
|
+
from: range[0],
|
|
3534
|
+
plus: range[1] - range[0] + 1
|
|
3535
|
+
};
|
|
3536
|
+
}).sort(function (a, b) {
|
|
3537
|
+
return a.from - b.from;
|
|
3538
|
+
});
|
|
3296
3539
|
drawCount += 1;
|
|
3297
3540
|
p = performance.now();
|
|
3298
3541
|
self.visibleRowHeights = []; // if data length has changed, there is no way to know
|
|
@@ -3407,9 +3650,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3407
3650
|
cell.selectionHandle = 'tr';
|
|
3408
3651
|
}
|
|
3409
3652
|
|
|
3410
|
-
if (cell.selectionBorderTop && cell.selectionBorderLeft
|
|
3411
|
-
|
|
3412
|
-
|
|
3653
|
+
if (cell.selectionBorderTop && cell.selectionBorderLeft) {
|
|
3654
|
+
if (self.mobile) {
|
|
3655
|
+
selectionHandles.push([cell, 'tl']);
|
|
3656
|
+
cell.selectionHandle = 'tl';
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
if (self.fillOverlay.handle) {
|
|
3660
|
+
self.fillOverlay.snapTo = {
|
|
3661
|
+
x: cell.x,
|
|
3662
|
+
y: cell.y
|
|
3663
|
+
};
|
|
3664
|
+
}
|
|
3413
3665
|
}
|
|
3414
3666
|
|
|
3415
3667
|
if (cell.selectionBorderBottom && cell.selectionBorderLeft && self.mobile) {
|
|
@@ -3420,6 +3672,23 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3420
3672
|
if (cell.selectionBorderBottom && cell.selectionBorderRight && (self.attributes.selectionHandleBehavior !== 'none' || self.mobile)) {
|
|
3421
3673
|
selectionHandles.push([cell, 'br']);
|
|
3422
3674
|
cell.selectionHandle = 'br';
|
|
3675
|
+
|
|
3676
|
+
if (self.fillOverlay.handle) {
|
|
3677
|
+
self.fillOverlay.handle.x = cell.x + cell.width;
|
|
3678
|
+
self.fillOverlay.handle.y = cell.y + cell.height;
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
if (self.fillOverlay.handle) {
|
|
3683
|
+
// Some corners may not be displaying, so we get at least
|
|
3684
|
+
// one correct axis in order to display a fill overlay.
|
|
3685
|
+
if (self.fillOverlay.snapTo.x === -1 && cell.selectionBorderLeft) {
|
|
3686
|
+
self.fillOverlay.snapTo.x = cell.x;
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3689
|
+
if (self.fillOverlay.snapTo.y === -1 && cell.selectionBorderTop) {
|
|
3690
|
+
self.fillOverlay.snapTo.y = cell.y;
|
|
3691
|
+
}
|
|
3423
3692
|
}
|
|
3424
3693
|
}
|
|
3425
3694
|
}
|
|
@@ -3480,7 +3749,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3480
3749
|
isColumnHeaderCellCap = cellStyle === 'columnHeaderCellCap',
|
|
3481
3750
|
rawValue = rowData ? rowData[header.name] : undefined,
|
|
3482
3751
|
isGrid = header.type === 'canvas-datagrid',
|
|
3483
|
-
activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex || self.orders.columns[self.activeCell.columnIndex] === headerIndex) && (columnOrderIndex === -1 || rowOrderIndex === -1) ? isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell' : false,
|
|
3752
|
+
activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex || self.selectedRows.indexOf(rowOrderIndex) >= 0 || self.orders.columns[self.activeCell.columnIndex] === headerIndex || self.selectedColumns.indexOf(headerIndex) >= 0) && (columnOrderIndex === -1 || rowOrderIndex === -1) ? isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell' : false,
|
|
3484
3753
|
val,
|
|
3485
3754
|
f = self.formatters[header.type || 'string'],
|
|
3486
3755
|
orderByArrowSize = 0,
|
|
@@ -3800,6 +4069,20 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3800
4069
|
hasRowGap = collapsedRowGroups.find(function (group) {
|
|
3801
4070
|
return group.from === previousRowNumber && group.to === cell.boundRowIndex;
|
|
3802
4071
|
}) >= 0;
|
|
4072
|
+
} // We don't treat the row index difference from hidden rows as the row gap.
|
|
4073
|
+
|
|
4074
|
+
|
|
4075
|
+
if (hasRowGap && self.hiddenRowRanges.length > 0) {
|
|
4076
|
+
for (var i = 0; i < self.hiddenRowRanges.length; i++) {
|
|
4077
|
+
var _self$hiddenRowRanges = _slicedToArray(self.hiddenRowRanges[i], 2),
|
|
4078
|
+
beginRowIndex = _self$hiddenRowRanges[0],
|
|
4079
|
+
endRowIndex = _self$hiddenRowRanges[1];
|
|
4080
|
+
|
|
4081
|
+
if (cell.boundRowIndex === endRowIndex + 1 && previousRowNumber === beginRowIndex - 1) {
|
|
4082
|
+
hasRowGap = false;
|
|
4083
|
+
break;
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
3803
4086
|
}
|
|
3804
4087
|
|
|
3805
4088
|
if (hasRowGap) {
|
|
@@ -3810,11 +4093,162 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3810
4093
|
fillRect(cell.x, cell.y - barHeight / 2, cell.width, barHeight);
|
|
3811
4094
|
self.ctx.restore();
|
|
3812
4095
|
}
|
|
3813
|
-
}
|
|
4096
|
+
} //#region draw unhide indicator for column headers
|
|
4097
|
+
|
|
4098
|
+
|
|
4099
|
+
if (isColumnHeader && self.attributes.showUnhideColumnsIndicator) {
|
|
4100
|
+
var _hovered = self.hovers.unhideIndicator;
|
|
4101
|
+
var size = self.style.unhideIndicatorSize;
|
|
4102
|
+
var cellX = x;
|
|
4103
|
+
var topY = cell.y + Math.max(0.5 * (cell.height - size), 0);
|
|
4104
|
+
|
|
4105
|
+
var isActive = function isActive(orderIndex) {
|
|
4106
|
+
return _hovered && (_hovered.dir === 'l' || _hovered.dir === 'r') && orderIndex >= _hovered.orderIndex0 && orderIndex <= _hovered.orderIndex1;
|
|
4107
|
+
};
|
|
4108
|
+
|
|
4109
|
+
var isHiddenColumn = function isHiddenColumn(columnIndex) {
|
|
4110
|
+
return columnIndex >= 0 && schema[columnIndex] && schema[columnIndex].hidden;
|
|
4111
|
+
};
|
|
4112
|
+
|
|
4113
|
+
var orderIndex0, orderIndex1;
|
|
4114
|
+
|
|
4115
|
+
var drawIndicator = function drawIndicator(leftX, dir, active) {
|
|
4116
|
+
self.visibleUnhideIndicators.push({
|
|
4117
|
+
x: leftX - 1,
|
|
4118
|
+
y: topY - 1,
|
|
4119
|
+
x2: leftX + size + 2,
|
|
4120
|
+
y2: topY + size + 2,
|
|
4121
|
+
orderIndex0: orderIndex0,
|
|
4122
|
+
orderIndex1: orderIndex1,
|
|
4123
|
+
dir: dir
|
|
4124
|
+
});
|
|
4125
|
+
|
|
4126
|
+
if (!active) {
|
|
4127
|
+
var line = cell.text && cell.text.lines && cell.text.lines[0];
|
|
4128
|
+
|
|
4129
|
+
if (line) {
|
|
4130
|
+
var iconsWidth = orderByArrowSize + treeArrowSize;
|
|
4131
|
+
var lineX0 = iconsWidth > 0 ? iconsWidth : line.x;
|
|
4132
|
+
var lineX1 = line.x + line.width;
|
|
4133
|
+
if (leftX + size >= lineX0 && leftX <= lineX1) return;
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
drawUnhideIndicator(leftX, topY, size, dir, active);
|
|
4138
|
+
}; // end of drawIndicator
|
|
4139
|
+
|
|
4140
|
+
|
|
4141
|
+
var orderIndexPtr = columnOrderIndex - 1;
|
|
4142
|
+
var prevColumnIndex = self.orders.columns[orderIndexPtr];
|
|
4143
|
+
|
|
4144
|
+
if (isHiddenColumn(prevColumnIndex)) {
|
|
4145
|
+
var _active = isActive(prevColumnIndex);
|
|
4146
|
+
|
|
4147
|
+
orderIndex0 = orderIndexPtr;
|
|
4148
|
+
orderIndex1 = orderIndexPtr;
|
|
4149
|
+
|
|
4150
|
+
while (--orderIndexPtr >= 0) {
|
|
4151
|
+
if (isHiddenColumn(self.orders.columns[orderIndexPtr])) orderIndex0 = orderIndexPtr;else break;
|
|
4152
|
+
}
|
|
4153
|
+
|
|
4154
|
+
drawIndicator(cellX, 'r', _active);
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
orderIndexPtr = columnOrderIndex + 1;
|
|
4158
|
+
var nextColumnIndex = self.orders.columns[orderIndexPtr];
|
|
4159
|
+
|
|
4160
|
+
if (isHiddenColumn(nextColumnIndex)) {
|
|
4161
|
+
var _active2 = isActive(nextColumnIndex);
|
|
4162
|
+
|
|
4163
|
+
orderIndex0 = orderIndexPtr;
|
|
4164
|
+
orderIndex1 = orderIndexPtr;
|
|
4165
|
+
|
|
4166
|
+
while (++orderIndexPtr < self.orders.columns.length) {
|
|
4167
|
+
if (isHiddenColumn(self.orders.columns[orderIndexPtr])) orderIndex1 = orderIndexPtr;else break;
|
|
4168
|
+
}
|
|
4169
|
+
|
|
4170
|
+
var indicatorX = x + cell.width - size;
|
|
4171
|
+
drawIndicator(indicatorX, 'l', _active2);
|
|
4172
|
+
}
|
|
4173
|
+
} //#endregion draw unhide indicator for column headers
|
|
4174
|
+
//#region draw unhide indicator for row headers
|
|
4175
|
+
|
|
4176
|
+
|
|
4177
|
+
if (isRowHeader && self.attributes.showUnhideRowsIndicator && self.hiddenRowRanges.length > 0) {
|
|
4178
|
+
// Leo's comment:
|
|
4179
|
+
// from the first row to the last row, `rowIndex` is from 0 to the count of rows
|
|
4180
|
+
// but `boundRowIndex` can be disordered if there are any ordered columns or filtered columns
|
|
4181
|
+
// Like this statement:
|
|
4182
|
+
// console.log(rowIndex, cell.boundRowIndex, cell.formattedValue);
|
|
4183
|
+
// can output the result like this:
|
|
4184
|
+
// 0 1 '2'
|
|
4185
|
+
// 1 3 '4'
|
|
4186
|
+
var _hovered2 = self.hovers.unhideIndicator;
|
|
4187
|
+
var _size = self.style.unhideIndicatorSize;
|
|
4188
|
+
var leftX = cell.x + cell.width - _size - 2;
|
|
4189
|
+
var cellY = y;
|
|
4190
|
+
var topIndicators = {};
|
|
4191
|
+
var bottomIndicators = {};
|
|
4192
|
+
self.hiddenRowRanges.forEach(function (it) {
|
|
4193
|
+
topIndicators[it[0] - 1] = it;
|
|
4194
|
+
bottomIndicators[it[1] + 1] = it;
|
|
4195
|
+
});
|
|
4196
|
+
|
|
4197
|
+
var _rowIndex = cell.rowIndex + currentRowIndexOffset;
|
|
4198
|
+
|
|
4199
|
+
var _isActive = function _isActive() {
|
|
4200
|
+
return _hovered2 && (_hovered2.dir === 't' || _hovered2.dir === 'b') && _rowIndex >= _hovered2.orderIndex0 - 1 && _rowIndex <= _hovered2.orderIndex1 + 1;
|
|
4201
|
+
};
|
|
4202
|
+
|
|
4203
|
+
var _orderIndex, _orderIndex2;
|
|
4204
|
+
|
|
4205
|
+
var _drawIndicator = function _drawIndicator(topY, dir, active) {
|
|
4206
|
+
self.visibleUnhideIndicators.push({
|
|
4207
|
+
x: leftX - 1,
|
|
4208
|
+
y: topY - 1,
|
|
4209
|
+
x2: leftX + _size + 2,
|
|
4210
|
+
y2: topY + _size + 2,
|
|
4211
|
+
orderIndex0: _orderIndex,
|
|
4212
|
+
orderIndex1: _orderIndex2,
|
|
4213
|
+
dir: dir
|
|
4214
|
+
});
|
|
4215
|
+
drawUnhideIndicator(leftX, topY, _size, dir, active);
|
|
4216
|
+
}; // end of drawIndicator
|
|
4217
|
+
|
|
4218
|
+
|
|
4219
|
+
var matched = topIndicators[_rowIndex];
|
|
4220
|
+
|
|
4221
|
+
if (matched) {
|
|
4222
|
+
var indicatorY = cellY + cell.height - _size;
|
|
4223
|
+
var _matched = matched;
|
|
4224
|
+
|
|
4225
|
+
var _matched2 = _slicedToArray(_matched, 2);
|
|
4226
|
+
|
|
4227
|
+
_orderIndex = _matched2[0];
|
|
4228
|
+
_orderIndex2 = _matched2[1];
|
|
4229
|
+
|
|
4230
|
+
_drawIndicator(indicatorY, 't', _isActive());
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
matched = bottomIndicators[_rowIndex];
|
|
4234
|
+
|
|
4235
|
+
if (matched) {
|
|
4236
|
+
var _indicatorY = cellY;
|
|
4237
|
+
var _matched3 = matched;
|
|
4238
|
+
|
|
4239
|
+
var _matched4 = _slicedToArray(_matched3, 2);
|
|
4240
|
+
|
|
4241
|
+
_orderIndex = _matched4[0];
|
|
4242
|
+
_orderIndex2 = _matched4[1];
|
|
4243
|
+
|
|
4244
|
+
_drawIndicator(_indicatorY, 'b', _isActive());
|
|
4245
|
+
}
|
|
4246
|
+
} //#endregion draw unhide indicator for row headers
|
|
4247
|
+
|
|
3814
4248
|
|
|
3815
4249
|
x += cell.width + (bc ? 0 : self.style.cellBorderWidth);
|
|
3816
4250
|
return cell.width;
|
|
3817
|
-
};
|
|
4251
|
+
}; // end of drawEach
|
|
3818
4252
|
}
|
|
3819
4253
|
|
|
3820
4254
|
function drawFilterButton(cell, ev) {
|
|
@@ -3851,8 +4285,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3851
4285
|
// row index + 1. If rowIndex > viewData.length, it's a new row
|
|
3852
4286
|
// added to the end, and we want to render that new row's number
|
|
3853
4287
|
|
|
3854
|
-
var filteredRowNumber
|
|
4288
|
+
var filteredRowNumber;
|
|
4289
|
+
if (self.viewData && rowIndex < self.viewData.length) filteredRowNumber = self.getBoundRowIndexFromViewRowIndex(rowIndex) + 1;else filteredRowNumber = self.originalData ? self.originalData.length + 1 : rowOrderIndex + 1;
|
|
3855
4290
|
var rowHeaderValue = self.hasActiveFilters() || self.hasCollapsedRowGroup() ? filteredRowNumber : rowIndex + 1;
|
|
4291
|
+
rowHeaderValue += currentRowIndexOffset;
|
|
3856
4292
|
var _rowHeaderCell = {
|
|
3857
4293
|
rowHeaderCell: rowHeaderValue
|
|
3858
4294
|
};
|
|
@@ -3866,6 +4302,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3866
4302
|
};
|
|
3867
4303
|
rowOpen = self.openChildren[rowIndex];
|
|
3868
4304
|
drawCell(_rowHeaderCell, rowOrderIndex, rowIndex)(headerDescription, -1, -1);
|
|
4305
|
+
|
|
4306
|
+
if (rowIndexOffsetByHiddenRows[0] && rowHeaderValue >= rowIndexOffsetByHiddenRows[0].from) {
|
|
4307
|
+
var _rowIndexOffsetByHidd = rowIndexOffsetByHiddenRows.shift(),
|
|
4308
|
+
plus = _rowIndexOffsetByHidd.plus;
|
|
4309
|
+
|
|
4310
|
+
currentRowIndexOffset += plus;
|
|
4311
|
+
}
|
|
3869
4312
|
}
|
|
3870
4313
|
}
|
|
3871
4314
|
|
|
@@ -4017,7 +4460,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4017
4460
|
} //draw frozen columns
|
|
4018
4461
|
|
|
4019
4462
|
|
|
4020
|
-
x =
|
|
4463
|
+
x = 1;
|
|
4021
4464
|
|
|
4022
4465
|
if (self.attributes.showRowHeaders) {
|
|
4023
4466
|
x += rowHeaderCellWidth;
|
|
@@ -4094,10 +4537,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4094
4537
|
schema = self.getSchema();
|
|
4095
4538
|
self.visibleCells = [];
|
|
4096
4539
|
self.visibleGroups = [];
|
|
4540
|
+
self.visibleUnhideIndicators = [];
|
|
4097
4541
|
self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0.5;
|
|
4098
4542
|
self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : -0.5;
|
|
4099
4543
|
h = self.height;
|
|
4100
|
-
w = self.width;
|
|
4544
|
+
w = self.width; // patch for first row being hidden
|
|
4545
|
+
|
|
4546
|
+
var firstRowIndexOffset = rowIndexOffsetByHiddenRows[0];
|
|
4547
|
+
|
|
4548
|
+
if (firstRowIndexOffset && firstRowIndexOffset.from === 0) {
|
|
4549
|
+
currentRowIndexOffset = firstRowIndexOffset.plus;
|
|
4550
|
+
rowIndexOffsetByHiddenRows.shift();
|
|
4551
|
+
}
|
|
4101
4552
|
}
|
|
4102
4553
|
|
|
4103
4554
|
function drawBackground() {
|
|
@@ -4312,7 +4763,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4312
4763
|
if (containsEnd) rightX += toggleHandleSize;
|
|
4313
4764
|
}
|
|
4314
4765
|
|
|
4315
|
-
|
|
4766
|
+
drawLines(lineCoords);
|
|
4316
4767
|
ctx.restore();
|
|
4317
4768
|
pushToVisibleGroups(leftX, rightX);
|
|
4318
4769
|
};
|
|
@@ -4383,13 +4834,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4383
4834
|
|
|
4384
4835
|
|
|
4385
4836
|
if (group.from > 0) {
|
|
4386
|
-
var
|
|
4837
|
+
var _rowIndex2 = group.to + 1;
|
|
4387
4838
|
|
|
4388
|
-
var _row = rowGroupsRectInfo[
|
|
4839
|
+
var _row = rowGroupsRectInfo[_rowIndex2];
|
|
4389
4840
|
|
|
4390
4841
|
if (!_row) {
|
|
4391
|
-
|
|
4392
|
-
_row = rowGroupsRectInfo[
|
|
4842
|
+
_rowIndex2 = group.from - 1;
|
|
4843
|
+
_row = rowGroupsRectInfo[_rowIndex2];
|
|
4393
4844
|
if (!_row) return "continue"; // don't draw this group indicator because it is invisible
|
|
4394
4845
|
|
|
4395
4846
|
_topY = _row.y + _row.h - toggleHandleSize * 0.5;
|
|
@@ -4397,7 +4848,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4397
4848
|
_topY = _row.y;
|
|
4398
4849
|
}
|
|
4399
4850
|
|
|
4400
|
-
if (
|
|
4851
|
+
if (_rowIndex2 >= self.frozenRow) {
|
|
4401
4852
|
var compare = frozenRowsHeight + columnHeaderCellHeight - toggleHandlePadding; // don't draw this group indicator because it is hidden by frozen columns
|
|
4402
4853
|
|
|
4403
4854
|
if (_topY < compare) return "continue";
|
|
@@ -4513,7 +4964,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4513
4964
|
if (containsEnd) bottomY += toggleHandleSize;
|
|
4514
4965
|
}
|
|
4515
4966
|
|
|
4516
|
-
|
|
4967
|
+
drawLines(lineCoords);
|
|
4517
4968
|
ctx.restore();
|
|
4518
4969
|
pushToVisibleGroups(topY, bottomY);
|
|
4519
4970
|
};
|
|
@@ -4545,7 +4996,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4545
4996
|
if (self.attributes.allowFreezingRows) {
|
|
4546
4997
|
// HACK great, another stupid magic number.
|
|
4547
4998
|
// Background will appear as a 0.5px artifact behind the row freeze bar without this hack
|
|
4548
|
-
y
|
|
4999
|
+
if (y > columnHeaderCellHeight) y += self.style.frozenMarkerWidth;
|
|
5000
|
+
y += self.style.frozenMarkerBorderWidth - 0.4999999999;
|
|
4549
5001
|
}
|
|
4550
5002
|
|
|
4551
5003
|
self.lastFrozenRowPixel = y;
|
|
@@ -4656,14 +5108,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4656
5108
|
self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;
|
|
4657
5109
|
self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;
|
|
4658
5110
|
|
|
4659
|
-
if (self.currentCell.rowIndex !== self.reorderObject.rowIndex && self.currentCell.rowIndex > -1 && self.currentCell.rowIndex < l) {
|
|
5111
|
+
if (self.selectedRows.indexOf(self.reorderTarget.sortRowIndex) === -1 && self.currentCell.rowIndex !== self.reorderObject.rowIndex && self.currentCell.rowIndex > -1 && self.currentCell.rowIndex < l) {
|
|
4660
5112
|
addBorderLine(m, self.reorderTarget.sortRowIndex > self.reorderObject.sortRowIndex ? 'b' : 't');
|
|
4661
5113
|
}
|
|
4662
5114
|
} else if (self.dragMode === 'column-reorder' && self.reorderObject) {
|
|
4663
5115
|
var selectedColumns = self.selections[0];
|
|
4664
5116
|
|
|
4665
|
-
|
|
4666
|
-
|
|
5117
|
+
if (selectedColumns) {
|
|
5118
|
+
for (var k = 1; k < selectedColumns.length; k++) {
|
|
5119
|
+
b.width += self.getColumnWidth(self.orders.columns[selectedColumns[k]]);
|
|
5120
|
+
}
|
|
4667
5121
|
}
|
|
4668
5122
|
|
|
4669
5123
|
b.height = h;
|
|
@@ -4677,7 +5131,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4677
5131
|
self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;
|
|
4678
5132
|
self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;
|
|
4679
5133
|
|
|
4680
|
-
if (self.currentCell.sortColumnIndex !== self.reorderObject.sortColumnIndex && self.currentCell.sortColumnIndex > -1 && self.currentCell.sortColumnIndex < schema.length) {
|
|
5134
|
+
if (self.selectedColumns.indexOf(self.reorderTarget.sortColumnIndex) === -1 && self.currentCell.sortColumnIndex !== self.reorderObject.sortColumnIndex && self.reorderTarget.columnIndex !== self.reorderObject.columnIndex && self.currentCell.sortColumnIndex > -1 && self.currentCell.sortColumnIndex < schema.length) {
|
|
4681
5135
|
addBorderLine(m, self.reorderTarget.columnIndex > self.reorderObject.columnIndex ? 'r' : 'l');
|
|
4682
5136
|
}
|
|
4683
5137
|
}
|
|
@@ -4690,11 +5144,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4690
5144
|
}
|
|
4691
5145
|
|
|
4692
5146
|
function drawSelectionBorders() {
|
|
4693
|
-
self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;
|
|
4694
|
-
self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;
|
|
4695
|
-
|
|
4696
5147
|
function dsb(c) {
|
|
4697
|
-
|
|
5148
|
+
if (!self.fillOverlay.handle) {
|
|
5149
|
+
self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;
|
|
5150
|
+
self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;
|
|
5151
|
+
addBorderLine(c[0], c[1]);
|
|
5152
|
+
}
|
|
4698
5153
|
}
|
|
4699
5154
|
|
|
4700
5155
|
selectionBorders.filter(function (c) {
|
|
@@ -4718,10 +5173,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4718
5173
|
return c[0].rowIndex < self.frozenRow && c[0].columnIndex >= self.frozenColumn;
|
|
4719
5174
|
}).forEach(dsb);
|
|
4720
5175
|
self.ctx.restore();
|
|
5176
|
+
drawFillOverlay();
|
|
4721
5177
|
}
|
|
4722
5178
|
|
|
4723
5179
|
function drawSelectionHandles() {
|
|
4724
|
-
if (self.mobile || self.attributes.allowMovingSelection) {
|
|
5180
|
+
if ((self.mobile || self.attributes.allowMovingSelection) && self.attributes.editable) {
|
|
4725
5181
|
self.ctx.lineWidth = self.style.selectionHandleBorderWidth;
|
|
4726
5182
|
self.ctx.strokeStyle = self.style.selectionHandleBorderColor;
|
|
4727
5183
|
self.ctx.fillStyle = self.style.selectionHandleColor;
|
|
@@ -4741,6 +5197,47 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4741
5197
|
}
|
|
4742
5198
|
}
|
|
4743
5199
|
|
|
5200
|
+
function drawFillOverlay() {
|
|
5201
|
+
if (!self.fillOverlay.handle || !self.fillOverlay.snapTo) {
|
|
5202
|
+
return;
|
|
5203
|
+
}
|
|
5204
|
+
|
|
5205
|
+
self.ctx.save();
|
|
5206
|
+
var overlay = self.fillOverlay;
|
|
5207
|
+
var handle = overlay.handle;
|
|
5208
|
+
var toX = overlay.snapTo.x;
|
|
5209
|
+
var toY = overlay.snapTo.y; // The cell that the cursor is moving over. This may be unavailable
|
|
5210
|
+
// when the cursor is outside the grid or is pointing to something else.
|
|
5211
|
+
//
|
|
5212
|
+
// When unavailable, we use the actual position of the cursor to draw
|
|
5213
|
+
// the overlay.
|
|
5214
|
+
|
|
5215
|
+
var snap = overlay.snap; // Calculate the X, Y coordinates of the cursor with snap positions and
|
|
5216
|
+
// the direction of the movement in mind.
|
|
5217
|
+
//
|
|
5218
|
+
// When the movement is horizontal, we get the Y coordinate from the handle,
|
|
5219
|
+
// and vice-versa.
|
|
5220
|
+
|
|
5221
|
+
var cursorX = overlay.direction === 'x' ? snap ? snap.x + (overlay.x < toX ? 0 : snap.width) : overlay.x : handle.x;
|
|
5222
|
+
var cursorY = overlay.direction === undefined || overlay.direction === 'y' ? snap ? snap.y + (overlay.y < toY ? 0 : snap.height) : overlay.y : handle.y; // The final coordinates of the rect. We use 'minX' and 'minY' to avoid
|
|
5223
|
+
// drawing on the frozen area.
|
|
5224
|
+
|
|
5225
|
+
var x = Math.max(Math.min(toX, cursorX), overlay.minX);
|
|
5226
|
+
var y = Math.max(Math.min(toY, cursorY), overlay.minY); // Width and height of the rect are the difference between the
|
|
5227
|
+
// coordinates of both the rect and the cursor. The user may be pointing
|
|
5228
|
+
// behind and/or upwards of the rect, so we need to take that into
|
|
5229
|
+
// account.
|
|
5230
|
+
|
|
5231
|
+
var width = Math.max(toX, cursorX) - x;
|
|
5232
|
+
var height = Math.max(toY, cursorY) - y;
|
|
5233
|
+
self.ctx.strokeStyle = self.style.fillOverlayBorderColor;
|
|
5234
|
+
self.ctx.lineWidth = self.style.fillOverlayBorderWidth;
|
|
5235
|
+
self.ctx.setLineDash([3, 3]);
|
|
5236
|
+
strokeRect(x, y, width, height);
|
|
5237
|
+
self.ctx.setLineDash([]);
|
|
5238
|
+
self.ctx.restore();
|
|
5239
|
+
}
|
|
5240
|
+
|
|
4744
5241
|
function drawActiveCell() {
|
|
4745
5242
|
if (!aCell) {
|
|
4746
5243
|
return;
|
|
@@ -4771,40 +5268,67 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4771
5268
|
}
|
|
4772
5269
|
|
|
4773
5270
|
function drawFrozenMarkers() {
|
|
4774
|
-
if (self.dragStartObject !== undefined) return;
|
|
4775
5271
|
var my = self.lastFrozenRowPixel - self.style.frozenMarkerWidth,
|
|
4776
|
-
mx = self.lastFrozenColumnPixel - self.style.
|
|
5272
|
+
mx = self.lastFrozenColumnPixel - self.style.frozenMarkerWidth,
|
|
4777
5273
|
xHover = self.currentCell && self.currentCell.style === 'frozen-row-marker',
|
|
4778
5274
|
yHover = self.currentCell && self.currentCell.style === 'frozen-column-marker';
|
|
5275
|
+
var rowHeaderCellWidth = self.getRowHeaderCellWidth();
|
|
4779
5276
|
self.ctx.lineWidth = self.style.frozenMarkerBorderWidth;
|
|
4780
5277
|
|
|
4781
5278
|
if (self.attributes.allowFreezingColumns) {
|
|
4782
|
-
self.
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
style:
|
|
4792
|
-
|
|
5279
|
+
if (!self.freezeMarkerPosition || self.freezeMarkerPosition && self.dragMode === 'frozen-row-marker') {
|
|
5280
|
+
if (mx > self.style.rowHeaderCellWidth) {
|
|
5281
|
+
self.ctx.fillStyle = self.style.frozenMarkerColor;
|
|
5282
|
+
self.ctx.strokeStyle = self.style.frozenMarkerBorderColor;
|
|
5283
|
+
fillRect(mx, 0, self.style.frozenMarkerWidth, self.height);
|
|
5284
|
+
strokeRect(mx, 0, self.style.frozenMarkerWidth, self.height);
|
|
5285
|
+
}
|
|
5286
|
+
|
|
5287
|
+
self.ctx.fillStyle = yHover ? self.style.frozenMarkerHoverColor : self.style.frozenMarkerHeaderColor;
|
|
5288
|
+
self.ctx.strokeStyle = yHover ? self.style.frozenMarkerHoverBorderColor : self.style.frozenMarkerHeaderColor;
|
|
5289
|
+
fillRect(mx, 0, self.style.frozenMarkerWidth, self.style.columnHeaderCellHeight);
|
|
5290
|
+
strokeRect(mx, 0, self.style.frozenMarkerWidth, self.style.columnHeaderCellHeight);
|
|
5291
|
+
}
|
|
5292
|
+
|
|
5293
|
+
if (!self.dragStartObject || self.dragStartObject && self.dragStartObject.style !== 'rowHeaderCell') {
|
|
5294
|
+
self.visibleCells.unshift({
|
|
5295
|
+
x: mx,
|
|
5296
|
+
y: 0,
|
|
5297
|
+
height: self.height,
|
|
5298
|
+
width: self.style.frozenMarkerWidth,
|
|
5299
|
+
// + self.style.frozenMarkerBorderWidth,
|
|
5300
|
+
style: 'frozen-column-marker'
|
|
5301
|
+
});
|
|
5302
|
+
}
|
|
4793
5303
|
}
|
|
4794
5304
|
|
|
4795
5305
|
if (self.attributes.allowFreezingRows) {
|
|
4796
|
-
self.
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
5306
|
+
if (!self.freezeMarkerPosition || self.freezeMarkerPosition && self.dragMode === 'frozen-column-marker') {
|
|
5307
|
+
if (my > rowHeaderCellWidth) {
|
|
5308
|
+
self.ctx.fillStyle = self.style.frozenMarkerColor;
|
|
5309
|
+
self.ctx.strokeStyle = self.style.frozenMarkerBorderColor;
|
|
5310
|
+
fillRect(0, my, self.width, self.style.frozenMarkerWidth);
|
|
5311
|
+
strokeRect(0, my, self.width, self.style.frozenMarkerWidth);
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5314
|
+
self.ctx.fillStyle = xHover ? self.style.frozenMarkerHoverColor : self.style.frozenMarkerHeaderColor;
|
|
5315
|
+
self.ctx.strokeStyle = xHover ? self.style.frozenMarkerHoverBorderColor : self.style.frozenMarkerHeaderColor;
|
|
5316
|
+
fillRect(0, my, rowHeaderCellWidth, self.style.frozenMarkerWidth);
|
|
5317
|
+
strokeRect(0, my, rowHeaderCellWidth, self.style.frozenMarkerWidth);
|
|
5318
|
+
}
|
|
5319
|
+
|
|
4800
5320
|
var height = self.style.frozenMarkerWidth + self.style.frozenMarkerBorderWidth;
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
5321
|
+
|
|
5322
|
+
if (!self.dragStartObject || self.dragStartObject && self.dragStartObject.style !== 'columnHeaderCell') {
|
|
5323
|
+
self.visibleCells.unshift({
|
|
5324
|
+
x: 0,
|
|
5325
|
+
y: my,
|
|
5326
|
+
height: height,
|
|
5327
|
+
width: self.width,
|
|
5328
|
+
style: 'frozen-row-marker'
|
|
5329
|
+
});
|
|
5330
|
+
}
|
|
5331
|
+
|
|
4808
5332
|
rowGroupsFrozenInfo = {
|
|
4809
5333
|
y: my,
|
|
4810
5334
|
h: height
|
|
@@ -4816,11 +5340,59 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4816
5340
|
self.ctx.strokeStyle = self.style.frozenMarkerActiveBorderColor;
|
|
4817
5341
|
|
|
4818
5342
|
if (self.dragMode === 'frozen-column-marker') {
|
|
4819
|
-
|
|
4820
|
-
|
|
5343
|
+
var posX = self.freezeMarkerPosition.x;
|
|
5344
|
+
var nearCell = self.getCellAt(posX, 0);
|
|
5345
|
+
if (self.freezeMarkerPosition.isGrab) posX = mx;
|
|
5346
|
+
|
|
5347
|
+
if (posX > rowHeaderCellWidth) {
|
|
5348
|
+
var _x = nearCell.x - self.style.frozenMarkerWidth - self.style.frozenMarkerBorderWidth;
|
|
5349
|
+
|
|
5350
|
+
if (posX > _x + nearCell.width / 2) _x = _x + nearCell.width;
|
|
5351
|
+
self.ctx.fillStyle = self.style.frozenMarkerColor;
|
|
5352
|
+
self.ctx.strokeStyle = self.style.frozenMarkerBorderColor;
|
|
5353
|
+
fillRect(_x, 0, self.style.frozenMarkerWidth, self.height);
|
|
5354
|
+
strokeRect(_x, 0, self.style.frozenMarkerWidth, self.height);
|
|
5355
|
+
self.ctx.fillStyle = self.style.frozenMarkerHeaderColor;
|
|
5356
|
+
self.ctx.strokeStyle = self.style.frozenMarkerHeaderColor;
|
|
5357
|
+
fillRect(_x, 0, self.style.frozenMarkerWidth, self.style.columnHeaderCellHeight);
|
|
5358
|
+
strokeRect(_x, 0, self.style.frozenMarkerWidth, self.style.columnHeaderCellHeight);
|
|
5359
|
+
}
|
|
5360
|
+
|
|
5361
|
+
self.ctx.fillStyle = self.style.frozenMarkerActiveHeaderColor;
|
|
5362
|
+
self.ctx.strokeStyle = self.style.frozenMarkerActiveBorderColor;
|
|
5363
|
+
fillRect(posX, 0, self.style.frozenMarkerWidth, self.style.columnHeaderCellHeight);
|
|
5364
|
+
strokeRect(posX, 0, self.style.frozenMarkerWidth, self.style.columnHeaderCellHeight);
|
|
5365
|
+
self.ctx.fillStyle = self.style.frozenMarkerActiveColor;
|
|
5366
|
+
fillRect(posX, 0, self.style.frozenMarkerWidth, self.height);
|
|
5367
|
+
strokeRect(posX, 0, self.style.frozenMarkerWidth, self.height);
|
|
4821
5368
|
} else {
|
|
4822
|
-
|
|
4823
|
-
|
|
5369
|
+
var posY = self.freezeMarkerPosition.y;
|
|
5370
|
+
|
|
5371
|
+
var _nearCell = self.getCellAt(0, posY);
|
|
5372
|
+
|
|
5373
|
+
if (self.freezeMarkerPosition.isGrab) posY = my;
|
|
5374
|
+
|
|
5375
|
+
if (posY > self.style.columnHeaderCellHeight) {
|
|
5376
|
+
var _y = _nearCell.y - self.style.frozenMarkerWidth - self.style.frozenMarkerBorderWidth;
|
|
5377
|
+
|
|
5378
|
+
if (posY > _y + _nearCell.height / 2) _y = _y + _nearCell.height;
|
|
5379
|
+
self.ctx.fillStyle = self.style.frozenMarkerColor;
|
|
5380
|
+
self.ctx.strokeStyle = self.style.frozenMarkerBorderColor;
|
|
5381
|
+
fillRect(0, _y, self.width, self.style.frozenMarkerWidth);
|
|
5382
|
+
strokeRect(0, _y, self.width, self.style.frozenMarkerWidth);
|
|
5383
|
+
self.ctx.fillStyle = self.style.frozenMarkerHeaderColor;
|
|
5384
|
+
self.ctx.strokeStyle = self.style.frozenMarkerHeaderColor;
|
|
5385
|
+
fillRect(0, _y, rowHeaderCellWidth, self.style.frozenMarkerWidth);
|
|
5386
|
+
strokeRect(0, _y, rowHeaderCellWidth, self.style.frozenMarkerWidth);
|
|
5387
|
+
}
|
|
5388
|
+
|
|
5389
|
+
self.ctx.fillStyle = self.style.frozenMarkerActiveHeaderColor;
|
|
5390
|
+
self.ctx.strokeStyle = self.style.frozenMarkerActiveBorderColor;
|
|
5391
|
+
fillRect(0, posY, rowHeaderCellWidth, self.style.frozenMarkerWidth);
|
|
5392
|
+
strokeRect(0, posY, rowHeaderCellWidth, self.style.frozenMarkerWidth);
|
|
5393
|
+
self.ctx.fillStyle = self.style.frozenMarkerActiveColor;
|
|
5394
|
+
fillRect(0, posY, self.width, self.style.frozenMarkerWidth);
|
|
5395
|
+
strokeRect(0, posY, self.width, self.style.frozenMarkerWidth);
|
|
4824
5396
|
}
|
|
4825
5397
|
}
|
|
4826
5398
|
}
|
|
@@ -5024,6 +5596,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5024
5596
|
/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
|
|
5025
5597
|
|
|
5026
5598
|
|
|
5599
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
5600
|
+
|
|
5601
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5602
|
+
|
|
5603
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5604
|
+
|
|
5027
5605
|
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; } } }; }
|
|
5028
5606
|
|
|
5029
5607
|
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); }
|
|
@@ -5103,6 +5681,43 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5103
5681
|
self.getRatio = function () {
|
|
5104
5682
|
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));
|
|
5105
5683
|
};
|
|
5684
|
+
/**
|
|
5685
|
+
* @returns {number} dataWidth
|
|
5686
|
+
*/
|
|
5687
|
+
|
|
5688
|
+
|
|
5689
|
+
self.refreshScrollCacheX = function () {
|
|
5690
|
+
var s = self.getSchema();
|
|
5691
|
+
self.scrollCache.x = [];
|
|
5692
|
+
/** @type {number} it will be used in `reduceSchema` only */
|
|
5693
|
+
|
|
5694
|
+
var frozenWidth = 0;
|
|
5695
|
+
var collapsedColumnGroups = self.getCollapsedColumnGroups();
|
|
5696
|
+
|
|
5697
|
+
var isColumnCollapsed = function isColumnCollapsed(columnIndex) {
|
|
5698
|
+
return collapsedColumnGroups.findIndex(function (group) {
|
|
5699
|
+
return columnIndex >= group.from && columnIndex <= group.to;
|
|
5700
|
+
}) >= 0;
|
|
5701
|
+
};
|
|
5702
|
+
|
|
5703
|
+
var dataWidth = s.reduce(function reduceSchema(accumulator, column, columnIndex) {
|
|
5704
|
+
// intentional redefintion of column. This causes scrollCache to be in the correct order
|
|
5705
|
+
var schemaIndex = self.orders.columns[columnIndex];
|
|
5706
|
+
var columnWidth = self.getColumnWidth(schemaIndex);
|
|
5707
|
+
column = s[schemaIndex];
|
|
5708
|
+
if (!column.hidden && !isColumnCollapsed(columnIndex)) accumulator += columnWidth;
|
|
5709
|
+
|
|
5710
|
+
if (columnIndex < self.frozenColumn) {
|
|
5711
|
+
self.scrollCache.x[columnIndex] = accumulator;
|
|
5712
|
+
frozenWidth = accumulator;
|
|
5713
|
+
} else {
|
|
5714
|
+
self.scrollCache.x[columnIndex] = Math.max(frozenWidth + columnWidth, accumulator);
|
|
5715
|
+
}
|
|
5716
|
+
|
|
5717
|
+
return accumulator;
|
|
5718
|
+
}, 0) || 0;
|
|
5719
|
+
return dataWidth;
|
|
5720
|
+
};
|
|
5106
5721
|
|
|
5107
5722
|
self.resize = function (drawAfterResize) {
|
|
5108
5723
|
if (!self.canvas) {
|
|
@@ -5163,8 +5778,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5163
5778
|
rowHeaderCellWidth = self.getRowHeaderCellWidth(),
|
|
5164
5779
|
topGroupAreaHeight = self.getColumnGroupAreaHeight(),
|
|
5165
5780
|
leftGroupAreaWidth = self.getRowGroupAreaWidth(),
|
|
5166
|
-
ch = self.style.cellHeight
|
|
5167
|
-
s = self.getSchema(); // sets actual DOM canvas element
|
|
5781
|
+
ch = self.style.cellHeight; // sets actual DOM canvas element
|
|
5168
5782
|
|
|
5169
5783
|
function checkScrollBoxVisibility() {
|
|
5170
5784
|
self.scrollBox.horizontalBarVisible = self.style.width !== 'auto' && dataWidth > self.scrollBox.width && self.style.overflowX !== 'hidden' || self.style.overflowX === 'scroll';
|
|
@@ -5202,7 +5816,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5202
5816
|
});
|
|
5203
5817
|
}
|
|
5204
5818
|
|
|
5205
|
-
|
|
5819
|
+
dataWidth = self.refreshScrollCacheX();
|
|
5206
5820
|
self.scrollCache.y = [];
|
|
5207
5821
|
|
|
5208
5822
|
for (x = 0; x < l; x += 1) {
|
|
@@ -5215,34 +5829,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5215
5829
|
self.scrollCache.y[x] = dataHeight;
|
|
5216
5830
|
}
|
|
5217
5831
|
|
|
5218
|
-
var collapsedColumnGroups = self.getCollapsedColumnGroups();
|
|
5219
|
-
|
|
5220
|
-
var isColumnCollapsed = function isColumnCollapsed(columnIndex) {
|
|
5221
|
-
return collapsedColumnGroups.findIndex(function (group) {
|
|
5222
|
-
return columnIndex >= group.from && columnIndex <= group.to;
|
|
5223
|
-
}) >= 0;
|
|
5224
|
-
};
|
|
5225
|
-
/** @type {number} it will be used in `reduceSchema` only */
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
var frozenWidth = 0;
|
|
5229
|
-
dataWidth = s.reduce(function reduceSchema(accumulator, column, columnIndex) {
|
|
5230
|
-
// intentional redefintion of column. This causes scrollCache to be in the correct order
|
|
5231
|
-
var schemaIndex = self.orders.columns[columnIndex];
|
|
5232
|
-
var columnWidth = self.getColumnWidth(schemaIndex);
|
|
5233
|
-
column = s[schemaIndex];
|
|
5234
|
-
if (!column.hidden && !isColumnCollapsed(columnIndex)) accumulator += columnWidth;
|
|
5235
|
-
|
|
5236
|
-
if (columnIndex < self.frozenColumn) {
|
|
5237
|
-
self.scrollCache.x[columnIndex] = accumulator;
|
|
5238
|
-
frozenWidth = accumulator;
|
|
5239
|
-
} else {
|
|
5240
|
-
self.scrollCache.x[columnIndex] = Math.max(frozenWidth + columnWidth, accumulator);
|
|
5241
|
-
}
|
|
5242
|
-
|
|
5243
|
-
return accumulator;
|
|
5244
|
-
}, 0) || 0;
|
|
5245
|
-
|
|
5246
5832
|
if (self.attributes.showNewRow) {
|
|
5247
5833
|
dataHeight += ch;
|
|
5248
5834
|
}
|
|
@@ -5359,9 +5945,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5359
5945
|
self.page = Math.max(1, self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap); // set canvas drawing related items
|
|
5360
5946
|
|
|
5361
5947
|
if (!self.isChildGrid) {
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5948
|
+
var newWidth = self.width * ratio;
|
|
5949
|
+
var newHeight = self.height * ratio; // We need to check is settings size to canvas necessary,
|
|
5950
|
+
// because settings the canvas'size will cause the canvas and its state be cleared
|
|
5951
|
+
// even if the size is the same.
|
|
5952
|
+
// Notes: Please don't call `self.resize()` without a subsequent call to `self.draw()`
|
|
5953
|
+
|
|
5954
|
+
if (self.canvas.width !== newWidth || self.canvas.height !== newHeight) {
|
|
5955
|
+
self.canvas.width = newWidth;
|
|
5956
|
+
self.canvas.height = newHeight;
|
|
5957
|
+
self.ctx.scale(ratio, ratio);
|
|
5958
|
+
}
|
|
5365
5959
|
} // resize any open dom elements (input/textarea)
|
|
5366
5960
|
|
|
5367
5961
|
|
|
@@ -5451,6 +6045,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5451
6045
|
y = self.mouse.y,
|
|
5452
6046
|
cell = self.getCellAt(x, y),
|
|
5453
6047
|
delta,
|
|
6048
|
+
disallowVerticalAutoScroll = false,
|
|
6049
|
+
disallowHorizontalAutoScroll = false,
|
|
5454
6050
|
ev = {
|
|
5455
6051
|
NativeEvent: e,
|
|
5456
6052
|
cell: cell,
|
|
@@ -5486,6 +6082,21 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5486
6082
|
}
|
|
5487
6083
|
|
|
5488
6084
|
self.currentCell = cell;
|
|
6085
|
+
|
|
6086
|
+
if (!self.draggingItem && // It is not in dragging mode (avoid changing hovers frequent)
|
|
6087
|
+
cell && (cell.context === 'cell' || cell.context === self.cursorGrab)) {
|
|
6088
|
+
var indicator = self.getUnhideIndicator(self.mouse.x, self.mouse.y);
|
|
6089
|
+
|
|
6090
|
+
if (indicator) {
|
|
6091
|
+
self.cursor = 'pointer';
|
|
6092
|
+
self.hovers = {
|
|
6093
|
+
unhideIndicator: indicator
|
|
6094
|
+
};
|
|
6095
|
+
self.draw();
|
|
6096
|
+
return;
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
|
|
5489
6100
|
self.hovers = {};
|
|
5490
6101
|
|
|
5491
6102
|
if (!self.draggingItem && cell) {
|
|
@@ -5556,6 +6167,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5556
6167
|
dragBounds.top = -1;
|
|
5557
6168
|
dragBounds.bottom = self.viewData.length - 1;
|
|
5558
6169
|
if (dragBounds.left < 0) dragBounds.left = 0;
|
|
6170
|
+
if (dragBounds.left != dragBounds.right) self.isMultiColumnsSelected = true;else self.isMultiRowsSelected = false;
|
|
5559
6171
|
}
|
|
5560
6172
|
|
|
5561
6173
|
if (self.dragStartObject.rowIndex !== cell.rowIndex || self.dragStartObject.columnIndex !== cell.columnIndex) {
|
|
@@ -5638,6 +6250,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5638
6250
|
if ((!self.selectionBounds || dragBounds.top !== self.selectionBounds.top || dragBounds.left !== self.selectionBounds.left || dragBounds.bottom !== self.selectionBounds.bottom || dragBounds.right !== self.selectionBounds.right) && !ctrl) {
|
|
5639
6251
|
if (!(cell.hovered && self.hovers.onFilterButton)) {
|
|
5640
6252
|
self.selections = [];
|
|
6253
|
+
self.selectedRows = [];
|
|
6254
|
+
self.selectedColumns = [];
|
|
5641
6255
|
}
|
|
5642
6256
|
|
|
5643
6257
|
if (dragBounds.top === -1) {
|
|
@@ -5652,13 +6266,34 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5652
6266
|
}
|
|
5653
6267
|
} else {
|
|
5654
6268
|
self.selectArea(sBounds, true);
|
|
5655
|
-
|
|
6269
|
+
self.activeCell.rowIndex = sBounds.top;
|
|
6270
|
+
self.activeCell.columnIndex = sBounds.left;
|
|
6271
|
+
|
|
6272
|
+
if (sBounds.left == -1 && sBounds.top !== sBounds.bottom) {
|
|
6273
|
+
self.activeCell.columnIndex = 0;
|
|
6274
|
+
self.isMultiRowsSelected = true;
|
|
6275
|
+
self.isMultiColumnsSelected = false;
|
|
6276
|
+
}
|
|
5656
6277
|
}
|
|
5657
6278
|
}
|
|
6279
|
+
} else if (self.movingSelectionHandle) {
|
|
6280
|
+
delta = {
|
|
6281
|
+
x: Math.abs(self.dragStart.x - x),
|
|
6282
|
+
y: Math.abs(self.dragStart.y - y)
|
|
6283
|
+
}; // Disallow auto-scroll to the direction that overlay is not
|
|
6284
|
+
// moving towards.
|
|
6285
|
+
|
|
6286
|
+
if (self.fillOverlay.direction === 'y') {
|
|
6287
|
+
disallowHorizontalAutoScroll = true;
|
|
6288
|
+
} else if (self.fillOverlay.direction === 'x') {
|
|
6289
|
+
disallowVerticalAutoScroll = true;
|
|
6290
|
+
}
|
|
6291
|
+
}
|
|
5658
6292
|
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
var
|
|
6293
|
+
if (delta) {
|
|
6294
|
+
if (self.attributes.autoScrollOnMousemove || disallowVerticalAutoScroll || disallowHorizontalAutoScroll) {
|
|
6295
|
+
var movedVertically = !disallowVerticalAutoScroll && delta.y > self.attributes.autoScrollMargin;
|
|
6296
|
+
var movedHorizontally = !disallowHorizontalAutoScroll && delta.x > self.attributes.autoScrollMargin;
|
|
5662
6297
|
if (movedVertically && !movedHorizontally) self.autoScrollZone(e, -1, y, ctrl);else if (movedHorizontally && !movedVertically) self.autoScrollZone(e, x, -1, ctrl);else if (movedHorizontally && movedVertically) self.autoScrollZone(e, x, y, ctrl);
|
|
5663
6298
|
} else {
|
|
5664
6299
|
self.autoScrollZone(e, x, y, ctrl);
|
|
@@ -5726,6 +6361,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5726
6361
|
return;
|
|
5727
6362
|
}
|
|
5728
6363
|
|
|
6364
|
+
var unhideIndicator = self.getUnhideIndicator(pos.x, pos.y);
|
|
6365
|
+
|
|
6366
|
+
if (unhideIndicator) {
|
|
6367
|
+
var dir = unhideIndicator.dir,
|
|
6368
|
+
orderIndex0 = unhideIndicator.orderIndex0,
|
|
6369
|
+
orderIndex1 = unhideIndicator.orderIndex1;
|
|
6370
|
+
if (dir === 'l' || dir === 'r') self.unhideColumns(orderIndex0, orderIndex1);else self.unhideRows(orderIndex0, orderIndex1);
|
|
6371
|
+
return;
|
|
6372
|
+
}
|
|
6373
|
+
|
|
5729
6374
|
var group = self.getColumnGroupAt(pos.x, pos.y);
|
|
5730
6375
|
if (!group) group = self.getRowGroupAt(pos.x, pos.y);
|
|
5731
6376
|
|
|
@@ -5865,8 +6510,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5865
6510
|
}
|
|
5866
6511
|
|
|
5867
6512
|
self.resize();
|
|
5868
|
-
|
|
5869
|
-
|
|
6513
|
+
window.removeEventListener('mousemove', self.dragResizeColumn, false);
|
|
6514
|
+
window.removeEventListener('mouseup', self.stopDragResize, false);
|
|
5870
6515
|
self.setStorageData();
|
|
5871
6516
|
self.draw(true);
|
|
5872
6517
|
self.ignoreNextClick = true;
|
|
@@ -5943,7 +6588,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5943
6588
|
document.exitPointerLock();
|
|
5944
6589
|
}
|
|
5945
6590
|
|
|
5946
|
-
|
|
6591
|
+
window.removeEventListener('mousemove', self.scrollGrid, false);
|
|
5947
6592
|
};
|
|
5948
6593
|
|
|
5949
6594
|
self.dragReorder = function (e) {
|
|
@@ -5965,7 +6610,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5965
6610
|
}
|
|
5966
6611
|
|
|
5967
6612
|
if ((e.ctrlKey || e.metaKey || e.shiftKey) && self.reorderObject) {
|
|
5968
|
-
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected
|
|
6613
|
+
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected) {
|
|
5969
6614
|
self.selectColumn(self.draggingItem.header.index, false, false);
|
|
5970
6615
|
}
|
|
5971
6616
|
}
|
|
@@ -5982,6 +6627,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5982
6627
|
if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {
|
|
5983
6628
|
self.reorderObject = self.draggingItem;
|
|
5984
6629
|
if (self.isMultiRowsSelected) self.reorderObject = self.getVisibleCellByIndex(-1, self.activeCell.rowIndex);
|
|
6630
|
+
if (self.isMultiColumnsSelected) self.reorderObject = self.getVisibleCellByIndex(self.activeCell.columnIndex, -1);
|
|
5985
6631
|
if (!self.reorderObject) return;
|
|
5986
6632
|
self.reorderTarget = self.currentCell;
|
|
5987
6633
|
self.reorderObject.dragOffset = {
|
|
@@ -6004,8 +6650,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6004
6650
|
'row-reorder': 'rowIndex',
|
|
6005
6651
|
'column-reorder': 'sortColumnIndex'
|
|
6006
6652
|
}[self.dragMode];
|
|
6007
|
-
|
|
6008
|
-
|
|
6653
|
+
window.removeEventListener('mousemove', self.dragReorder, false);
|
|
6654
|
+
window.removeEventListener('mouseup', self.stopDragReorder, false);
|
|
6009
6655
|
|
|
6010
6656
|
if (self.reorderObject && self.reorderTarget && (self.dragMode === 'column-reorder' && self.reorderTarget.sortColumnIndex > -1 && self.reorderTarget.sortColumnIndex < self.getSchema().length || self.dragMode === 'row-reorder' && self.reorderTarget.rowIndex > -1 && self.reorderTarget.rowIndex < self.viewData.length) && self.reorderObject[i] !== self.reorderTarget[i] && !self.dispatchEvent('reorder', {
|
|
6011
6657
|
NativeEvent: e,
|
|
@@ -6019,27 +6665,34 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6019
6665
|
|
|
6020
6666
|
if (self.dragMode === 'column-reorder') {
|
|
6021
6667
|
var sortColumnIndices = [];
|
|
6022
|
-
var
|
|
6668
|
+
var selectedColumnIndices = [];
|
|
6023
6669
|
|
|
6024
6670
|
if (self.selections[0]) {
|
|
6671
|
+
oIndex = self.selections[0][0];
|
|
6025
6672
|
self.selections[0].forEach(function (value) {
|
|
6026
6673
|
sortColumnIndices.push(self.orders.columns[value]);
|
|
6027
6674
|
});
|
|
6028
6675
|
}
|
|
6029
6676
|
|
|
6030
6677
|
var deleteCount = sortColumnIndices.length;
|
|
6031
|
-
cr[self.dragMode].splice(oIndex, deleteCount);
|
|
6032
|
-
if (tIndex > oIndex) tIndex = tIndex - (deleteCount - 1);
|
|
6033
6678
|
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6679
|
+
if (tIndex < oIndex || tIndex > oIndex && Math.abs(tIndex - oIndex) >= deleteCount) {
|
|
6680
|
+
cr[self.dragMode].splice(oIndex, deleteCount);
|
|
6681
|
+
if (tIndex > oIndex) tIndex = tIndex - (deleteCount - 1);
|
|
6682
|
+
self.selectedColumns = [];
|
|
6038
6683
|
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6684
|
+
for (var i = 0; i < sortColumnIndices.length; i++) {
|
|
6685
|
+
if (i === 0) self.activeCell.columnIndex = tIndex;
|
|
6686
|
+
selectedColumnIndices.push(tIndex + i);
|
|
6687
|
+
self.selectedColumns.push(sortColumnIndices[i]);
|
|
6688
|
+
cr[self.dragMode].splice(tIndex + i, 0, sortColumnIndices[i]);
|
|
6689
|
+
}
|
|
6690
|
+
|
|
6691
|
+
self.orders.columns = cr[self.dragMode];
|
|
6692
|
+
self.viewData.forEach(function (row, rowIndex) {
|
|
6693
|
+
self.selections[rowIndex] = selectedColumnIndices;
|
|
6694
|
+
});
|
|
6695
|
+
}
|
|
6043
6696
|
} else {
|
|
6044
6697
|
var selectedRows = [];
|
|
6045
6698
|
self.selections.forEach(function (row, rowIndex) {
|
|
@@ -6048,14 +6701,19 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6048
6701
|
odata.push(self.viewData[rowIndex]);
|
|
6049
6702
|
}
|
|
6050
6703
|
});
|
|
6051
|
-
self.viewData.splice(oIndex, odata.length);
|
|
6052
|
-
self.selections = [];
|
|
6053
|
-
if (tIndex > oIndex) tIndex = tIndex - (odata.length - 1);
|
|
6054
|
-
self.activeCell.rowIndex = tIndex;
|
|
6055
6704
|
|
|
6056
|
-
|
|
6057
|
-
self.viewData.splice(
|
|
6058
|
-
self.selections
|
|
6705
|
+
if (tIndex < oIndex || tIndex > oIndex && Math.abs(tIndex - oIndex) >= odata.length) {
|
|
6706
|
+
self.viewData.splice(oIndex, odata.length);
|
|
6707
|
+
self.selections = [];
|
|
6708
|
+
self.selectedRows = [];
|
|
6709
|
+
if (tIndex > oIndex) tIndex = tIndex - (odata.length - 1);
|
|
6710
|
+
self.activeCell.rowIndex = tIndex;
|
|
6711
|
+
|
|
6712
|
+
for (var i = 0; i < odata.length; i++) {
|
|
6713
|
+
self.viewData.splice(tIndex + i, 0, odata[i]);
|
|
6714
|
+
self.selections[tIndex + i] = selectedRows[i];
|
|
6715
|
+
self.selectedRows.push(tIndex + i);
|
|
6716
|
+
}
|
|
6059
6717
|
}
|
|
6060
6718
|
}
|
|
6061
6719
|
|
|
@@ -6090,8 +6748,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6090
6748
|
};
|
|
6091
6749
|
|
|
6092
6750
|
self.stopDragMove = function (e) {
|
|
6093
|
-
|
|
6094
|
-
|
|
6751
|
+
window.removeEventListener('mousemove', self.dragMove, false);
|
|
6752
|
+
window.removeEventListener('mouseup', self.stopDragMove, false);
|
|
6095
6753
|
var b = self.getSelectionBounds();
|
|
6096
6754
|
|
|
6097
6755
|
if (self.dispatchEvent('endmove', {
|
|
@@ -6122,13 +6780,25 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6122
6780
|
return;
|
|
6123
6781
|
}
|
|
6124
6782
|
|
|
6783
|
+
var pos = self.getLayerPos(e);
|
|
6784
|
+
self.ignoreNextClick = true;
|
|
6785
|
+
self.freezeMarkerPosition = pos;
|
|
6786
|
+
pos.x -= self.getRowGroupAreaWidth();
|
|
6787
|
+
pos.y -= self.getColumnGroupAreaHeight();
|
|
6788
|
+
|
|
6789
|
+
if (Math.abs(pos.x) > self.attributes.reorderDeadZone || Math.abs(pos.y) > self.attributes.reorderDeadZone) {
|
|
6790
|
+
setTimeout(function () {
|
|
6791
|
+
self.autoScrollZone(e, pos.x, pos.y, false);
|
|
6792
|
+
}, 1);
|
|
6793
|
+
}
|
|
6794
|
+
};
|
|
6795
|
+
|
|
6796
|
+
self.stopFreezeMove = function (e) {
|
|
6125
6797
|
var pos = self.getLayerPos(e),
|
|
6126
6798
|
bm = self.style.gridBorderCollapse === 'collapse' ? 1 : 2,
|
|
6127
6799
|
columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * bm,
|
|
6128
6800
|
columnHeaderCellHeight = self.getColumnHeaderCellHeight(),
|
|
6129
6801
|
rowHeaderCellWidth = self.getRowHeaderCellWidth();
|
|
6130
|
-
self.ignoreNextClick = true;
|
|
6131
|
-
self.freezeMarkerPosition = pos;
|
|
6132
6802
|
pos.x -= self.getRowGroupAreaWidth();
|
|
6133
6803
|
pos.y -= self.getColumnGroupAreaHeight();
|
|
6134
6804
|
|
|
@@ -6145,12 +6815,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6145
6815
|
}
|
|
6146
6816
|
|
|
6147
6817
|
if (self.currentCell && self.currentCell.columnIndex !== undefined && self.dragMode === 'frozen-column-marker') {
|
|
6818
|
+
var dataWidth = self.refreshScrollCacheX();
|
|
6148
6819
|
self.scrollBox.scrollLeft = 0;
|
|
6149
|
-
|
|
6150
|
-
self.
|
|
6151
|
-
self.scrollBox.
|
|
6152
|
-
|
|
6153
|
-
self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn - 1]) / dataWidth;
|
|
6820
|
+
var x = self.currentCell.x - self.style.frozenMarkerWidth - self.style.frozenMarkerBorderWidth;
|
|
6821
|
+
if (pos.x > x + self.currentCell.width / 2) self.frozenColumn = self.currentCell.columnIndex + 1;else if (self.currentCell.columnIndex >= 0) self.frozenColumn = self.currentCell.columnIndex;
|
|
6822
|
+
self.scrollBox.bar.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn];
|
|
6823
|
+
self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn]) / dataWidth;
|
|
6154
6824
|
self.scrollBox.scrollBoxWidth = self.scrollBox.width * self.scrollBox.widthBoxRatio - self.style.scrollBarWidth;
|
|
6155
6825
|
self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
|
|
6156
6826
|
self.scrollBox.box.h.width = self.scrollBox.scrollBoxWidth;
|
|
@@ -6161,11 +6831,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6161
6831
|
self.autoScrollZone(e, pos.x, pos.y, false);
|
|
6162
6832
|
}, 1);
|
|
6163
6833
|
}
|
|
6164
|
-
};
|
|
6165
6834
|
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
document.body.removeEventListener('mouseup', self.stopFreezeMove, false);
|
|
6835
|
+
window.removeEventListener('mousemove', self.freezeMove, false);
|
|
6836
|
+
window.removeEventListener('mouseup', self.stopFreezeMove, false);
|
|
6169
6837
|
self.freezeMarkerPosition = undefined;
|
|
6170
6838
|
|
|
6171
6839
|
if (self.dispatchEvent('endfreezemove', {
|
|
@@ -6179,6 +6847,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6179
6847
|
}
|
|
6180
6848
|
|
|
6181
6849
|
self.draw(true);
|
|
6850
|
+
self.resize();
|
|
6182
6851
|
};
|
|
6183
6852
|
|
|
6184
6853
|
self.mousedown = function (e, overridePos) {
|
|
@@ -6202,7 +6871,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6202
6871
|
var ctrl = e.ctrlKey || e.metaKey,
|
|
6203
6872
|
move = /-move/.test(self.dragMode),
|
|
6204
6873
|
freeze = /frozen-row-marker|frozen-column-marker/.test(self.dragMode),
|
|
6205
|
-
resize = /-resize/.test(self.dragMode)
|
|
6874
|
+
resize = /-resize/.test(self.dragMode),
|
|
6875
|
+
selectionHandleMove = /selection-handle-br/.test(self.dragMode);
|
|
6876
|
+
var onUnhideIndicator = self.hovers && self.hovers.unhideIndicator;
|
|
6206
6877
|
self.dragStart = overridePos || self.getLayerPos(e);
|
|
6207
6878
|
self.scrollStart = {
|
|
6208
6879
|
left: self.scrollBox.scrollLeft,
|
|
@@ -6211,9 +6882,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6211
6882
|
self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);
|
|
6212
6883
|
self.dragAddToSelection = !self.dragStartObject.selected;
|
|
6213
6884
|
|
|
6214
|
-
if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/.test(self.dragStartObject.context) && self.currentCell && !self.currentCell.isColumnHeader && !move && !freeze && !resize) {
|
|
6885
|
+
if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/.test(self.dragStartObject.context) && self.currentCell && !self.currentCell.isColumnHeader && !move && !freeze && !resize && !selectionHandleMove) {
|
|
6215
6886
|
if (!(self.dragMode == 'row-reorder' && self.isMultiRowsSelected) && !(self.currentCell.hovered && self.hovers.onFilterButton)) {
|
|
6216
6887
|
self.selections = [];
|
|
6888
|
+
self.selectedRows = [];
|
|
6889
|
+
self.selectedColumns = [];
|
|
6217
6890
|
}
|
|
6218
6891
|
}
|
|
6219
6892
|
|
|
@@ -6221,7 +6894,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6221
6894
|
return;
|
|
6222
6895
|
}
|
|
6223
6896
|
|
|
6224
|
-
if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {
|
|
6897
|
+
if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1 && !onUnhideIndicator) {
|
|
6225
6898
|
self.scrollMode = self.dragStartObject.context;
|
|
6226
6899
|
self.scrollStartMode = self.dragStartObject.context;
|
|
6227
6900
|
self.scrollGrid(e);
|
|
@@ -6234,8 +6907,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6234
6907
|
self.canvas.requestPointerLock();
|
|
6235
6908
|
}
|
|
6236
6909
|
|
|
6237
|
-
|
|
6238
|
-
|
|
6910
|
+
window.addEventListener('mousemove', self.scrollGrid, false);
|
|
6911
|
+
window.addEventListener('mouseup', self.stopScrollGrid, false);
|
|
6239
6912
|
self.ignoreNextClick = true;
|
|
6240
6913
|
return;
|
|
6241
6914
|
}
|
|
@@ -6247,11 +6920,39 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6247
6920
|
self.selectRow(self.dragStartObject.rowIndex, ctrl, null);
|
|
6248
6921
|
} else if ((self.attributes.selectionMode === 'column' || self.dragStartObject.rowIndex === -1) && self.dragStartObject.columnIndex > -1) {
|
|
6249
6922
|
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
6250
|
-
|
|
6923
|
+
return;
|
|
6924
|
+
}
|
|
6925
|
+
|
|
6926
|
+
if (self.attributes.selectionMode !== 'row') {
|
|
6251
6927
|
self.mousemove(e);
|
|
6252
6928
|
}
|
|
6253
6929
|
|
|
6254
|
-
return;
|
|
6930
|
+
return;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
if (selectionHandleMove) {
|
|
6934
|
+
self.movingSelectionHandle = true;
|
|
6935
|
+
self.fillOverlay = {
|
|
6936
|
+
handle: {
|
|
6937
|
+
x: self.dragStartObject.x + self.dragStartObject.width / 2,
|
|
6938
|
+
y: self.dragStartObject.y + self.dragStartObject.height / 2
|
|
6939
|
+
},
|
|
6940
|
+
snapTo: {
|
|
6941
|
+
x: -1,
|
|
6942
|
+
y: -1
|
|
6943
|
+
},
|
|
6944
|
+
selection: self.getSelectionBounds()
|
|
6945
|
+
};
|
|
6946
|
+
|
|
6947
|
+
if (self.dispatchEvent('beginselectionhandlemove', {
|
|
6948
|
+
NativeEvent: e
|
|
6949
|
+
})) {
|
|
6950
|
+
return;
|
|
6951
|
+
}
|
|
6952
|
+
|
|
6953
|
+
window.addEventListener('mousemove', self.selectionHandleMove, false);
|
|
6954
|
+
window.addEventListener('mouseup', self.stopSelectionHandleMove, false);
|
|
6955
|
+
return self.selectionHandleMove(e);
|
|
6255
6956
|
}
|
|
6256
6957
|
|
|
6257
6958
|
if (move) {
|
|
@@ -6266,8 +6967,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6266
6967
|
return;
|
|
6267
6968
|
}
|
|
6268
6969
|
|
|
6269
|
-
|
|
6270
|
-
|
|
6970
|
+
window.addEventListener('mousemove', self.dragMove, false);
|
|
6971
|
+
window.addEventListener('mouseup', self.stopDragMove, false);
|
|
6271
6972
|
return self.mousemove(e);
|
|
6272
6973
|
}
|
|
6273
6974
|
|
|
@@ -6284,12 +6985,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6284
6985
|
return;
|
|
6285
6986
|
}
|
|
6286
6987
|
|
|
6287
|
-
|
|
6288
|
-
|
|
6988
|
+
self.freezeMarkerPosition = self.getLayerPos(e);
|
|
6989
|
+
self.freezeMarkerPosition.isGrab = true;
|
|
6990
|
+
window.addEventListener('mousemove', self.freezeMove, false);
|
|
6991
|
+
window.addEventListener('mouseup', self.stopFreezeMove, false);
|
|
6289
6992
|
return self.mousemove(e);
|
|
6290
6993
|
}
|
|
6291
6994
|
|
|
6292
|
-
if (resize) {
|
|
6995
|
+
if (resize && !onUnhideIndicator) {
|
|
6293
6996
|
self.draggingItem = self.dragItem;
|
|
6294
6997
|
|
|
6295
6998
|
if (self.draggingItem.rowOpen) {
|
|
@@ -6299,22 +7002,22 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6299
7002
|
}
|
|
6300
7003
|
|
|
6301
7004
|
self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell' ? 'cornerCell' : self.draggingItem.sortColumnIndex] || self.draggingItem.width;
|
|
6302
|
-
|
|
6303
|
-
|
|
7005
|
+
window.addEventListener('mousemove', self.dragResizeColumn, false);
|
|
7006
|
+
window.addEventListener('mouseup', self.stopDragResize, false);
|
|
6304
7007
|
return;
|
|
6305
7008
|
}
|
|
6306
7009
|
|
|
6307
7010
|
if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {
|
|
6308
7011
|
self.draggingItem = self.dragStartObject;
|
|
6309
7012
|
|
|
6310
|
-
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected
|
|
7013
|
+
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected) {
|
|
6311
7014
|
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
6312
7015
|
} else if (self.dragMode === 'row-reorder' && !self.isMultiRowsSelected) {
|
|
6313
7016
|
self.selectRow(self.dragStartObject.rowIndex, ctrl, null);
|
|
6314
7017
|
}
|
|
6315
7018
|
|
|
6316
|
-
|
|
6317
|
-
|
|
7019
|
+
window.addEventListener('mousemove', self.dragReorder, false);
|
|
7020
|
+
window.addEventListener('mouseup', self.stopDragReorder, false);
|
|
6318
7021
|
return;
|
|
6319
7022
|
}
|
|
6320
7023
|
};
|
|
@@ -6559,6 +7262,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6559
7262
|
if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {
|
|
6560
7263
|
if (!ctrl) {
|
|
6561
7264
|
self.selections = [];
|
|
7265
|
+
self.selectedRows = [];
|
|
7266
|
+
self.selectedColumns = [];
|
|
6562
7267
|
}
|
|
6563
7268
|
|
|
6564
7269
|
self.selections[y] = self.selections[y] || [];
|
|
@@ -6685,17 +7390,22 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6685
7390
|
};
|
|
6686
7391
|
|
|
6687
7392
|
self.pasteData = function (pasteValue, mimeType, startRowIndex, startColIndex) {
|
|
7393
|
+
var minRowsLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
7394
|
+
var minColumnsLength = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
7395
|
+
|
|
6688
7396
|
if (mimeType === 'text/html' && !(0,_util__WEBPACK_IMPORTED_MODULE_1__.isSupportedHtml)(pasteValue)) {
|
|
6689
7397
|
console.warn('Unrecognized HTML format. HTML must be a simple table, e.g.: <table><tr><td>data</td></tr></table>.');
|
|
6690
7398
|
console.warn('Data with the mime type text/html not in this format will not be imported as row data.');
|
|
6691
7399
|
return;
|
|
6692
7400
|
}
|
|
6693
7401
|
|
|
6694
|
-
|
|
6695
|
-
|
|
7402
|
+
self.selectedRows = [];
|
|
7403
|
+
self.selectedColumns = [];
|
|
7404
|
+
var rows = (0,_util__WEBPACK_IMPORTED_MODULE_1__.parseData)(pasteValue, mimeType);
|
|
7405
|
+
var columnsLength = rows[0].length; // selected cell. This mimics Excel's paste functionality, and works
|
|
6696
7406
|
// as a poor-man's fill-down.
|
|
6697
7407
|
|
|
6698
|
-
if (rows.length === 1 &&
|
|
7408
|
+
if (rows.length === 1 && columnsLength === 1 && minRowsLength <= 1 && minColumnsLength <= 1) {
|
|
6699
7409
|
var cellData = rows[0][0].value.map(function (item) {
|
|
6700
7410
|
return item.value;
|
|
6701
7411
|
}).join();
|
|
@@ -6703,62 +7413,169 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6703
7413
|
data[rowIndex][colName] = cellData;
|
|
6704
7414
|
});
|
|
6705
7415
|
} else {
|
|
6706
|
-
var
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
7416
|
+
var direction = null;
|
|
7417
|
+
|
|
7418
|
+
if (minRowsLength > rows.length && minColumnsLength > columnsLength) {
|
|
7419
|
+
direction = 'both';
|
|
7420
|
+
} else if (minRowsLength > rows.length) {
|
|
7421
|
+
direction = 'vertical';
|
|
7422
|
+
} else if (minColumnsLength > columnsLength) {
|
|
7423
|
+
direction = 'horizontal';
|
|
7424
|
+
}
|
|
7425
|
+
|
|
7426
|
+
self.insert({
|
|
7427
|
+
rows: rows,
|
|
7428
|
+
startRowIndex: startRowIndex,
|
|
7429
|
+
startColumnIndex: startColIndex,
|
|
7430
|
+
minRowsLength: minRowsLength,
|
|
7431
|
+
minColumnsLength: minColumnsLength,
|
|
7432
|
+
reverseRows: false,
|
|
7433
|
+
reverseColumns: false,
|
|
7434
|
+
clearSelections: true,
|
|
7435
|
+
alwaysFilling: false,
|
|
7436
|
+
direction: direction
|
|
7437
|
+
});
|
|
7438
|
+
} // selections is a sparse array, so we condense:
|
|
7439
|
+
|
|
7440
|
+
|
|
7441
|
+
var affectedCells = [];
|
|
7442
|
+
self.selections.forEach(function (row, rowIndex) {
|
|
7443
|
+
if (rowIndex === undefined) return;
|
|
7444
|
+
row.forEach(function (columnIndex) {
|
|
7445
|
+
affectedCells.push([rowIndex, columnIndex, self.getBoundRowIndexFromViewRowIndex(rowIndex), self.getBoundColumnIndexFromViewColumnIndex(columnIndex)]);
|
|
7446
|
+
});
|
|
7447
|
+
});
|
|
7448
|
+
self.dispatchEvent('afterpaste', {
|
|
7449
|
+
cells: affectedCells
|
|
7450
|
+
});
|
|
7451
|
+
return rows.length;
|
|
7452
|
+
};
|
|
7453
|
+
|
|
7454
|
+
self.insert = function (_ref) {
|
|
7455
|
+
var _ref$rows = _ref.rows,
|
|
7456
|
+
rows = _ref$rows === void 0 ? [] : _ref$rows,
|
|
7457
|
+
_ref$startRowIndex = _ref.startRowIndex,
|
|
7458
|
+
startRowIndex = _ref$startRowIndex === void 0 ? 0 : _ref$startRowIndex,
|
|
7459
|
+
_ref$startColumnIndex = _ref.startColumnIndex,
|
|
7460
|
+
startColumnIndex = _ref$startColumnIndex === void 0 ? 0 : _ref$startColumnIndex,
|
|
7461
|
+
_ref$minRowsLength = _ref.minRowsLength,
|
|
7462
|
+
minRowsLength = _ref$minRowsLength === void 0 ? 0 : _ref$minRowsLength,
|
|
7463
|
+
_ref$minColumnsLength = _ref.minColumnsLength,
|
|
7464
|
+
minColumnsLength = _ref$minColumnsLength === void 0 ? 0 : _ref$minColumnsLength,
|
|
7465
|
+
_ref$reverseRows = _ref.reverseRows,
|
|
7466
|
+
reverseRows = _ref$reverseRows === void 0 ? false : _ref$reverseRows,
|
|
7467
|
+
_ref$reverseColumns = _ref.reverseColumns,
|
|
7468
|
+
reverseColumns = _ref$reverseColumns === void 0 ? false : _ref$reverseColumns,
|
|
7469
|
+
_ref$clearSelections = _ref.clearSelections,
|
|
7470
|
+
clearSelections = _ref$clearSelections === void 0 ? false : _ref$clearSelections,
|
|
7471
|
+
_ref$alwaysFilling = _ref.alwaysFilling,
|
|
7472
|
+
alwaysFilling = _ref$alwaysFilling === void 0 ? false : _ref$alwaysFilling,
|
|
7473
|
+
_ref$direction = _ref.direction,
|
|
7474
|
+
direction = _ref$direction === void 0 ? 'both' : _ref$direction;
|
|
7475
|
+
var schema = self.getSchema();
|
|
7476
|
+
var rowsLength = Math.max(rows.length, minRowsLength);
|
|
7477
|
+
var fillCellCallback = self.fillCellCallback;
|
|
7478
|
+
var selections = clearSelections ? [] : self.selections;
|
|
7479
|
+
var filledCells = [];
|
|
7480
|
+
|
|
7481
|
+
for (var rowPosReal = 0, rowDataPos = 0; rowPosReal < rowsLength; rowPosReal++, rowDataPos++) {
|
|
7482
|
+
if (rowDataPos >= rows.length) {
|
|
7483
|
+
rowDataPos = 0;
|
|
7484
|
+
}
|
|
7485
|
+
|
|
7486
|
+
var fillingRow = rowPosReal >= rows.length;
|
|
7487
|
+
var rowPosition = reverseRows ? rowsLength - rowPosReal - 1 : rowPosReal; // Rows may have been moved by user, so get the actual row index
|
|
7488
|
+
// (instead of the row index at which the row is rendered):
|
|
7489
|
+
|
|
7490
|
+
var realRowIndex = self.orders.rows[startRowIndex + rowPosition];
|
|
7491
|
+
var cells = rows[rowDataPos];
|
|
7492
|
+
var cellsLength = Math.max(cells.length, minColumnsLength);
|
|
7493
|
+
var existingRowData = self.viewData[realRowIndex];
|
|
7494
|
+
var newRowData = Object.assign({}, existingRowData);
|
|
7495
|
+
var fillArgs = fillCellCallback ? {
|
|
7496
|
+
rows: rows,
|
|
7497
|
+
direction: direction,
|
|
7498
|
+
rowData: newRowData,
|
|
7499
|
+
existingRowData: existingRowData,
|
|
7500
|
+
rowIndex: realRowIndex,
|
|
7501
|
+
rowOffset: rowDataPos,
|
|
7502
|
+
cells: cells,
|
|
7503
|
+
reversed: direction === 'horizontal' ? reverseColumns : reverseRows,
|
|
7504
|
+
isFillingRow: fillingRow || alwaysFilling,
|
|
7505
|
+
fillingRowPosition: alwaysFilling ? rowPosReal : fillingRow ? rowPosReal - rows.length : -1,
|
|
7506
|
+
fillingRowLength: alwaysFilling ? rowsLength : fillingRow ? rowsLength - rows.length : -1
|
|
7507
|
+
} : undefined;
|
|
7508
|
+
self.selectedRows.push(realRowIndex);
|
|
7509
|
+
|
|
7510
|
+
if (selections[realRowIndex] === undefined) {
|
|
6715
7511
|
selections[realRowIndex] = [];
|
|
7512
|
+
}
|
|
6716
7513
|
|
|
6717
|
-
|
|
6718
|
-
|
|
7514
|
+
for (var colPosReal = 0, cellDataPos = 0; colPosReal < cellsLength; colPosReal++, cellDataPos++) {
|
|
7515
|
+
if (cellDataPos >= cells.length) {
|
|
7516
|
+
cellDataPos = 0;
|
|
7517
|
+
}
|
|
6719
7518
|
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
7519
|
+
var fillingColumn = colPosReal >= cells.length;
|
|
7520
|
+
var colPosition = reverseColumns ? cellsLength - colPosReal - 1 : colPosReal;
|
|
7521
|
+
var columnIndex = startColumnIndex + colPosition;
|
|
7522
|
+
var column = schema[columnIndex];
|
|
6724
7523
|
|
|
6725
|
-
|
|
6726
|
-
|
|
7524
|
+
if (!column) {
|
|
7525
|
+
console.warn('Paste data exceeded grid bounds. Skipping.');
|
|
7526
|
+
continue;
|
|
7527
|
+
}
|
|
7528
|
+
|
|
7529
|
+
var columnName = column.name;
|
|
7530
|
+
var cellData = cells[cellDataPos];
|
|
7531
|
+
|
|
7532
|
+
if (cellData && cellData.value) {
|
|
7533
|
+
cellData = cellData.value.map(function (item) {
|
|
6727
7534
|
return item.value;
|
|
6728
7535
|
}).join('');
|
|
7536
|
+
}
|
|
6729
7537
|
|
|
6730
|
-
|
|
6731
|
-
newRowData[columnName] = existingRowData[columnName];
|
|
6732
|
-
continue;
|
|
6733
|
-
}
|
|
7538
|
+
var existingCellData = existingRowData[columnName];
|
|
6734
7539
|
|
|
6735
|
-
|
|
6736
|
-
newRowData[columnName] =
|
|
7540
|
+
if (fillCellCallback && (fillingColumn || fillingRow || alwaysFilling)) {
|
|
7541
|
+
newRowData[columnName] = fillCellCallback(_objectSpread(_objectSpread({}, fillArgs), {}, {
|
|
7542
|
+
column: column,
|
|
7543
|
+
columnIndex: columnIndex,
|
|
7544
|
+
columnOffset: cellDataPos,
|
|
7545
|
+
newCellData: cellData,
|
|
7546
|
+
existingCellData: existingCellData,
|
|
7547
|
+
isFillingColumn: fillingColumn || alwaysFilling,
|
|
7548
|
+
fillingColumnPosition: alwaysFilling ? colPosReal : fillingColumn ? colPosReal - cells.length : -1,
|
|
7549
|
+
fillingColumnLength: alwaysFilling ? cellsLength : fillingColumn ? cellsLength - cells.length : -1
|
|
7550
|
+
}));
|
|
7551
|
+
} else {
|
|
7552
|
+
newRowData[columnName] = cellData === undefined || cellData === null ? existingCellData : cellData;
|
|
6737
7553
|
}
|
|
6738
7554
|
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
7555
|
+
selections[realRowIndex].push(columnIndex);
|
|
7556
|
+
|
|
7557
|
+
if (alwaysFilling || fillingRow || fillingColumn) {
|
|
7558
|
+
filledCells.push([realRowIndex, columnIndex, self.getBoundRowIndexFromViewRowIndex(realRowIndex), self.getBoundColumnIndexFromViewColumnIndex(columnIndex)]);
|
|
7559
|
+
}
|
|
6743
7560
|
|
|
6744
|
-
self.
|
|
7561
|
+
if (self.selectedColumns.indexOf(columnIndex) === -1) self.selectedColumns.push(columnIndex);
|
|
6745
7562
|
}
|
|
6746
7563
|
|
|
6747
|
-
self.
|
|
6748
|
-
|
|
7564
|
+
self.originalData[self.boundRowIndexMap.get(realRowIndex)] = newRowData; // Update view date here to avoid a full refresh of `viewData`.
|
|
7565
|
+
// To stay in line with Excel and Google Sheet behaviour,
|
|
7566
|
+
// don't perform a full refresh (and filter/sort results)
|
|
7567
|
+
// as this would make any pasted values disappear and/or suddenly change position.
|
|
6749
7568
|
|
|
7569
|
+
self.viewData[realRowIndex] = newRowData;
|
|
7570
|
+
}
|
|
6750
7571
|
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
7572
|
+
self.selections = selections;
|
|
7573
|
+
|
|
7574
|
+
if (filledCells.length > 0 || alwaysFilling) {
|
|
7575
|
+
self.dispatchEvent('afterfill', {
|
|
7576
|
+
filledCells: filledCells
|
|
6756
7577
|
});
|
|
6757
|
-
}
|
|
6758
|
-
self.dispatchEvent('afterpaste', {
|
|
6759
|
-
cells: affectedCells
|
|
6760
|
-
});
|
|
6761
|
-
return rows.length;
|
|
7578
|
+
}
|
|
6762
7579
|
};
|
|
6763
7580
|
|
|
6764
7581
|
self.getNextVisibleColumnIndex = function (visibleColumnIndex) {
|
|
@@ -6787,6 +7604,24 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6787
7604
|
return -1;
|
|
6788
7605
|
};
|
|
6789
7606
|
|
|
7607
|
+
self.getSelectionIndex = function () {
|
|
7608
|
+
for (var rowIndex = 0, len = self.selections.length; rowIndex < len; rowIndex++) {
|
|
7609
|
+
var row = self.selections[rowIndex];
|
|
7610
|
+
|
|
7611
|
+
if (row) {
|
|
7612
|
+
if (row[0] === undefined) break;
|
|
7613
|
+
return {
|
|
7614
|
+
row: rowIndex,
|
|
7615
|
+
column: row[0] < 0 ? row[1] : row[0],
|
|
7616
|
+
rowLength: len - rowIndex,
|
|
7617
|
+
columnLength: row.length - (row[0] < 0 ? 1 : 0)
|
|
7618
|
+
};
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7622
|
+
return null;
|
|
7623
|
+
};
|
|
7624
|
+
|
|
6790
7625
|
self.paste = function (event) {
|
|
6791
7626
|
if (!self.attributes.editable) {
|
|
6792
7627
|
return;
|
|
@@ -6820,24 +7655,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6820
7655
|
return;
|
|
6821
7656
|
}
|
|
6822
7657
|
|
|
6823
|
-
var
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
for (var rowIndex = 0, len = self.selections.length; rowIndex < len; rowIndex++) {
|
|
6827
|
-
var row = self.selections[rowIndex];
|
|
6828
|
-
|
|
6829
|
-
if (row) {
|
|
6830
|
-
if (row[0] === undefined) return;
|
|
6831
|
-
startCell = [rowIndex, row[0] < 0 ? row[1] : row[0]];
|
|
6832
|
-
break;
|
|
6833
|
-
}
|
|
6834
|
-
} // itemToPaste is cleared once accessed (getData or getAsString),
|
|
7658
|
+
var selectionIndex = self.getSelectionIndex();
|
|
7659
|
+
if (!selectionIndex) return;
|
|
7660
|
+
var itemToPaste = pasteableItems[0]; // itemToPaste is cleared once accessed (getData or getAsString),
|
|
6835
7661
|
// so we need to store the type here, before reading its value:
|
|
6836
7662
|
|
|
6837
|
-
|
|
6838
7663
|
var pasteType = itemToPaste.type;
|
|
6839
7664
|
itemToPaste.getAsString(function (pasteValue) {
|
|
6840
|
-
self.pasteData(pasteValue, pasteType,
|
|
7665
|
+
self.pasteData(pasteValue, pasteType, selectionIndex.row, selectionIndex.column, selectionIndex.rowLength, selectionIndex.columnLength);
|
|
6841
7666
|
self.draw();
|
|
6842
7667
|
});
|
|
6843
7668
|
};
|
|
@@ -6881,6 +7706,145 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6881
7706
|
event.preventDefault();
|
|
6882
7707
|
};
|
|
6883
7708
|
|
|
7709
|
+
self.selectionHandleMove = function (e) {
|
|
7710
|
+
if (!self.movingSelectionHandle) {
|
|
7711
|
+
return;
|
|
7712
|
+
}
|
|
7713
|
+
|
|
7714
|
+
var clippingRect = self.getClippingRect(e);
|
|
7715
|
+
var rowIndex = self.currentCell.rowIndex;
|
|
7716
|
+
var columnIndex = self.currentCell.columnIndex;
|
|
7717
|
+
var isInSelectionBounds = rowIndex >= -1 && columnIndex >= -1 && self.fillOverlay.selection.left <= columnIndex && self.fillOverlay.selection.right >= columnIndex && self.fillOverlay.selection.top <= rowIndex && self.fillOverlay.selection.bottom >= rowIndex;
|
|
7718
|
+
self.fillOverlay.minX = clippingRect.x;
|
|
7719
|
+
self.fillOverlay.minY = clippingRect.y;
|
|
7720
|
+
self.fillOverlay.x = Math.max(clippingRect.x, e.clientX);
|
|
7721
|
+
self.fillOverlay.y = Math.max(clippingRect.y, e.clientY); // If we are in the selection bounds, allow user to change directions.
|
|
7722
|
+
|
|
7723
|
+
if (isInSelectionBounds) {
|
|
7724
|
+
self.fillOverlay.lastInBoundsLocation = {
|
|
7725
|
+
x: e.clientX,
|
|
7726
|
+
y: e.clientY
|
|
7727
|
+
};
|
|
7728
|
+
} else if (self.fillOverlay.lastInBoundsLocation || !self.fillOverlay.direction) {
|
|
7729
|
+
var lastInBoundsLocation = self.fillOverlay.lastInBoundsLocation;
|
|
7730
|
+
self.fillOverlay.lastInBoundsLocation = undefined;
|
|
7731
|
+
var x = lastInBoundsLocation ? lastInBoundsLocation.x : self.fillOverlay.handle.x;
|
|
7732
|
+
var y = lastInBoundsLocation ? lastInBoundsLocation.y : self.fillOverlay.handle.y;
|
|
7733
|
+
var dx = Math.abs(e.clientX - x);
|
|
7734
|
+
var dy = Math.abs(e.clientY - y);
|
|
7735
|
+
|
|
7736
|
+
if (dx > 5 || dy > 5) {
|
|
7737
|
+
self.fillOverlay.direction = dx > dy ? 'x' : 'y';
|
|
7738
|
+
}
|
|
7739
|
+
}
|
|
7740
|
+
|
|
7741
|
+
if (rowIndex >= 0) {
|
|
7742
|
+
self.fillOverlay.rowIndex = rowIndex;
|
|
7743
|
+
}
|
|
7744
|
+
|
|
7745
|
+
if (columnIndex >= 0) {
|
|
7746
|
+
self.fillOverlay.columnIndex = columnIndex;
|
|
7747
|
+
|
|
7748
|
+
if (rowIndex === -1 && self.visibleRows.length) {
|
|
7749
|
+
self.fillOverlay.rowIndex = self.visibleRows[0];
|
|
7750
|
+
}
|
|
7751
|
+
}
|
|
7752
|
+
|
|
7753
|
+
if (rowIndex >= -1 && columnIndex >= -1) {
|
|
7754
|
+
self.fillOverlay.snap = self.currentCell;
|
|
7755
|
+
} else {
|
|
7756
|
+
self.fillOverlay.snap = undefined;
|
|
7757
|
+
}
|
|
7758
|
+
};
|
|
7759
|
+
|
|
7760
|
+
self.stopSelectionHandleMove = function (e) {
|
|
7761
|
+
if (!self.fillOverlay.handle) {
|
|
7762
|
+
return false;
|
|
7763
|
+
}
|
|
7764
|
+
|
|
7765
|
+
self.ignoreNextClick = true;
|
|
7766
|
+
window.removeEventListener('mousemove', self.selectionHandleMove, false);
|
|
7767
|
+
window.removeEventListener('mouseup', self.stopSelectionHandleMove, false);
|
|
7768
|
+
var overlay = self.fillOverlay;
|
|
7769
|
+
var selectionIndex = self.getSelectionIndex();
|
|
7770
|
+
var bounds = overlay.selection;
|
|
7771
|
+
if (!selectionIndex) return;
|
|
7772
|
+
self.movingSelectionHandle = undefined;
|
|
7773
|
+
self.fillOverlay = {};
|
|
7774
|
+
|
|
7775
|
+
if (overlay.rowIndex >= 0 && overlay.columnIndex >= 0) {
|
|
7776
|
+
var boundsOld = _objectSpread({}, bounds);
|
|
7777
|
+
|
|
7778
|
+
var isVertical = overlay.direction === 'y';
|
|
7779
|
+
var isHorizontal = overlay.direction === 'x';
|
|
7780
|
+
var startRow,
|
|
7781
|
+
rowLength,
|
|
7782
|
+
startColumn,
|
|
7783
|
+
columnLength,
|
|
7784
|
+
reverseVertically = false,
|
|
7785
|
+
reverseHorizontally = false;
|
|
7786
|
+
|
|
7787
|
+
if (isVertical) {
|
|
7788
|
+
if (overlay.rowIndex < bounds.top) {
|
|
7789
|
+
bounds.top = overlay.rowIndex;
|
|
7790
|
+
reverseVertically = true;
|
|
7791
|
+
} else if (overlay.rowIndex > bounds.bottom) {
|
|
7792
|
+
bounds.bottom = overlay.rowIndex;
|
|
7793
|
+
}
|
|
7794
|
+
|
|
7795
|
+
startRow = bounds.top < boundsOld.top ? bounds.top : boundsOld.bottom + 1;
|
|
7796
|
+
rowLength = bounds.top < boundsOld.top ? boundsOld.top - bounds.top : bounds.bottom - boundsOld.bottom;
|
|
7797
|
+
startColumn = selectionIndex.column;
|
|
7798
|
+
columnLength = selectionIndex.columnLength;
|
|
7799
|
+
} else if (isHorizontal) {
|
|
7800
|
+
if (overlay.columnIndex < bounds.left) {
|
|
7801
|
+
bounds.left = overlay.columnIndex;
|
|
7802
|
+
reverseHorizontally = true;
|
|
7803
|
+
} else if (overlay.columnIndex > bounds.right) {
|
|
7804
|
+
bounds.right = overlay.columnIndex;
|
|
7805
|
+
}
|
|
7806
|
+
|
|
7807
|
+
startColumn = bounds.left < boundsOld.left ? bounds.left : boundsOld.right + 1;
|
|
7808
|
+
columnLength = bounds.left < boundsOld.left ? boundsOld.left - bounds.left : bounds.right - boundsOld.right;
|
|
7809
|
+
startRow = selectionIndex.row;
|
|
7810
|
+
rowLength = selectionIndex.rowLength;
|
|
7811
|
+
}
|
|
7812
|
+
|
|
7813
|
+
if (bounds.left <= bounds.right && bounds.top <= bounds.bottom && (bounds.left < boundsOld.left || bounds.top < boundsOld.top || bounds.right > boundsOld.right || bounds.bottom > boundsOld.bottom)) {
|
|
7814
|
+
var schema = self.getSchema();
|
|
7815
|
+
var rows = [];
|
|
7816
|
+
|
|
7817
|
+
for (var rowIndex = 0; rowIndex < Math.min(rowLength, selectionIndex.rowLength); rowIndex++) {
|
|
7818
|
+
var rowData = self.viewData[selectionIndex.row + rowIndex];
|
|
7819
|
+
rows[rowIndex] = [];
|
|
7820
|
+
|
|
7821
|
+
for (var columnIndex = 0; columnIndex < Math.min(columnLength, selectionIndex.columnLength); columnIndex++) {
|
|
7822
|
+
var column = schema[selectionIndex.column + columnIndex];
|
|
7823
|
+
if (!column) continue;
|
|
7824
|
+
var cellData = rowData[column.name];
|
|
7825
|
+
rows[rowIndex][columnIndex] = cellData;
|
|
7826
|
+
}
|
|
7827
|
+
}
|
|
7828
|
+
|
|
7829
|
+
self.insert({
|
|
7830
|
+
rows: rows,
|
|
7831
|
+
startRowIndex: startRow,
|
|
7832
|
+
startColumnIndex: startColumn,
|
|
7833
|
+
minRowsLength: rowLength,
|
|
7834
|
+
minColumnsLength: columnLength,
|
|
7835
|
+
reverseRows: reverseVertically,
|
|
7836
|
+
reverseColumns: reverseHorizontally,
|
|
7837
|
+
clearSelections: false,
|
|
7838
|
+
alwaysFilling: true,
|
|
7839
|
+
direction: isHorizontal ? 'horizontal' : 'vertical'
|
|
7840
|
+
});
|
|
7841
|
+
self.draw();
|
|
7842
|
+
}
|
|
7843
|
+
}
|
|
7844
|
+
|
|
7845
|
+
return true;
|
|
7846
|
+
};
|
|
7847
|
+
|
|
6884
7848
|
return;
|
|
6885
7849
|
}
|
|
6886
7850
|
|
|
@@ -7070,6 +8034,90 @@ var createHTMLString = function createHTMLString(selectedData, isNeat) {
|
|
|
7070
8034
|
|
|
7071
8035
|
|
|
7072
8036
|
|
|
8037
|
+
/***/ }),
|
|
8038
|
+
|
|
8039
|
+
/***/ "./lib/groups/util.js":
|
|
8040
|
+
/*!****************************!*\
|
|
8041
|
+
!*** ./lib/groups/util.js ***!
|
|
8042
|
+
\****************************/
|
|
8043
|
+
/*! namespace exports */
|
|
8044
|
+
/*! export mergeHiddenRowRanges [provided] [no usage info] [missing usage info prevents renaming] */
|
|
8045
|
+
/*! other exports [not provided] [no usage info] */
|
|
8046
|
+
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
|
|
8047
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8048
|
+
|
|
8049
|
+
"use strict";
|
|
8050
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8051
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8052
|
+
/* harmony export */ "mergeHiddenRowRanges": function() { return /* binding */ mergeHiddenRowRanges; }
|
|
8053
|
+
/* harmony export */ });
|
|
8054
|
+
|
|
8055
|
+
/**
|
|
8056
|
+
* Merge a new hidden row range into existed ranges array
|
|
8057
|
+
* @param {any[]} hiddenRowRanges tuples: Array<[bgeinRowIndex, endRowIndex]>
|
|
8058
|
+
* @param {number[]} newRange tuple: [beginRowIndex, endRowIndex]
|
|
8059
|
+
* @returns {boolean}
|
|
8060
|
+
*/
|
|
8061
|
+
|
|
8062
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8063
|
+
|
|
8064
|
+
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."); }
|
|
8065
|
+
|
|
8066
|
+
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); }
|
|
8067
|
+
|
|
8068
|
+
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; }
|
|
8069
|
+
|
|
8070
|
+
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; }
|
|
8071
|
+
|
|
8072
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8073
|
+
|
|
8074
|
+
var mergeHiddenRowRanges = function mergeHiddenRowRanges(hiddenRowRanges, newRange) {
|
|
8075
|
+
var _newRange = _slicedToArray(newRange, 2),
|
|
8076
|
+
beginRowIndex = _newRange[0],
|
|
8077
|
+
endRowIndex = _newRange[1];
|
|
8078
|
+
|
|
8079
|
+
if (endRowIndex < beginRowIndex) return false;
|
|
8080
|
+
var inserted = false;
|
|
8081
|
+
|
|
8082
|
+
for (var i = 0; i < hiddenRowRanges.length; i++) {
|
|
8083
|
+
var range = hiddenRowRanges[i];
|
|
8084
|
+
if (beginRowIndex > range[1] + 1) continue;
|
|
8085
|
+
|
|
8086
|
+
if (beginRowIndex <= range[0] && endRowIndex >= range[0]) {
|
|
8087
|
+
hiddenRowRanges[i] = [beginRowIndex, Math.max(endRowIndex, range[1])];
|
|
8088
|
+
inserted = true;
|
|
8089
|
+
break;
|
|
8090
|
+
}
|
|
8091
|
+
|
|
8092
|
+
if (beginRowIndex >= range[0]) {
|
|
8093
|
+
hiddenRowRanges[i] = [range[0], Math.max(endRowIndex, range[1])];
|
|
8094
|
+
inserted = true;
|
|
8095
|
+
break;
|
|
8096
|
+
}
|
|
8097
|
+
}
|
|
8098
|
+
|
|
8099
|
+
if (!inserted) hiddenRowRanges.push([beginRowIndex, endRowIndex]); // merge intersections after sorting ranges
|
|
8100
|
+
|
|
8101
|
+
hiddenRowRanges.sort(function (a, b) {
|
|
8102
|
+
return a[0] - b[0];
|
|
8103
|
+
});
|
|
8104
|
+
|
|
8105
|
+
for (var _i2 = 0; _i2 < hiddenRowRanges.length - 1; _i2++) {
|
|
8106
|
+
var _range = hiddenRowRanges[_i2];
|
|
8107
|
+
var nextRange = hiddenRowRanges[_i2 + 1];
|
|
8108
|
+
|
|
8109
|
+
if (nextRange[0] <= _range[1] + 1) {
|
|
8110
|
+
hiddenRowRanges[_i2] = [_range[0], Math.max(_range[1], nextRange[1])];
|
|
8111
|
+
hiddenRowRanges.splice(_i2 + 1, 1);
|
|
8112
|
+
_i2--;
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
8115
|
+
|
|
8116
|
+
return true;
|
|
8117
|
+
};
|
|
8118
|
+
|
|
8119
|
+
|
|
8120
|
+
|
|
7073
8121
|
/***/ }),
|
|
7074
8122
|
|
|
7075
8123
|
/***/ "./lib/intf.js":
|
|
@@ -7171,6 +8219,21 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7171
8219
|
self.scrollBox = {};
|
|
7172
8220
|
self.visibleRows = [];
|
|
7173
8221
|
self.visibleCells = [];
|
|
8222
|
+
/**
|
|
8223
|
+
* Each item of this array contains these properties:
|
|
8224
|
+
* - `x`, `y`, `x2`, `y2`
|
|
8225
|
+
* - `orderIndex0`, `orderIndex1`: The closed interval of the hiding rows/columns.
|
|
8226
|
+
* - `dir`: The directon of the unhide indicator. 'l' and 'r' for columns, 't' and 'b' for rows
|
|
8227
|
+
*/
|
|
8228
|
+
|
|
8229
|
+
self.visibleUnhideIndicators = [];
|
|
8230
|
+
/**
|
|
8231
|
+
* Each item is a tuple conatins two numbers:
|
|
8232
|
+
* its type difination: Array<[beginRowIndex, endRowIndex]>
|
|
8233
|
+
* Each tuple represents a closed Interval
|
|
8234
|
+
*/
|
|
8235
|
+
|
|
8236
|
+
self.hiddenRowRanges = [];
|
|
7174
8237
|
/**
|
|
7175
8238
|
* This array stored all groups information with context for drawing,
|
|
7176
8239
|
* it is generated by drawing functions,
|
|
@@ -7192,6 +8255,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7192
8255
|
trees: {}
|
|
7193
8256
|
};
|
|
7194
8257
|
self.selections = [];
|
|
8258
|
+
self.selectedRows = [];
|
|
8259
|
+
self.selectedColumns = [];
|
|
8260
|
+
self.fillOverlay = {};
|
|
7195
8261
|
self.filterable = {
|
|
7196
8262
|
rows: [],
|
|
7197
8263
|
columns: []
|
|
@@ -7251,7 +8317,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7251
8317
|
self.groupedRows = [];
|
|
7252
8318
|
self.scrollModes = ['vertical-scroll-box', 'vertical-scroll-top', 'vertical-scroll-bottom', 'horizontal-scroll-box', 'horizontal-scroll-right', 'horizontal-scroll-left'];
|
|
7253
8319
|
self.componentL1Events = {};
|
|
7254
|
-
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'];
|
|
8320
|
+
self.eventNames = ['afterdraw', 'afterrendercell', 'afterrenderfilterbutton', 'aftercreategroup', 'attributechanged', 'beforebeginedit', 'beforecreatecellgrid', 'beforedraw', 'beforeendedit', 'beforerendercell', 'beforerendercellgrid', 'beforerenderfilterbutton', 'beginedit', 'cellmouseout', 'cellmouseover', 'click', 'collapsetree', 'columnhide', 'columnunhide', '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'];
|
|
7255
8321
|
self.mouse = {
|
|
7256
8322
|
x: 0,
|
|
7257
8323
|
y: 0
|
|
@@ -7469,7 +8535,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7469
8535
|
if (columnIndex < 0) continue;
|
|
7470
8536
|
var boundColumnIndex = self.getBoundColumnIndexFromViewColumnIndex(columnIndex);
|
|
7471
8537
|
var columnName = schema[boundColumnIndex].name;
|
|
7472
|
-
self.
|
|
8538
|
+
self.viewData[boundRowIndex][columnName] = '';
|
|
7473
8539
|
affectedCells.push([rowIndex, columnIndex, boundRowIndex, boundColumnIndex]);
|
|
7474
8540
|
}
|
|
7475
8541
|
} catch (err) {
|
|
@@ -7832,7 +8898,23 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7832
8898
|
// useful when emitting cell events.
|
|
7833
8899
|
var newViewData = originalData.map(function (row, originalRowIndex) {
|
|
7834
8900
|
return [row, originalRowIndex];
|
|
7835
|
-
}); //
|
|
8901
|
+
}); // Remove hidden rows here. So we can keep the bound indexes correct
|
|
8902
|
+
|
|
8903
|
+
if (self.hiddenRowRanges.length > 0) {
|
|
8904
|
+
var ranges = self.hiddenRowRanges.sort(function (a, b) {
|
|
8905
|
+
return b[1] - a[1];
|
|
8906
|
+
});
|
|
8907
|
+
|
|
8908
|
+
for (var i = 0; i < ranges.length; i++) {
|
|
8909
|
+
var _ranges$i = _slicedToArray(ranges[i], 2),
|
|
8910
|
+
beginRowIndex = _ranges$i[0],
|
|
8911
|
+
endRowIndex = _ranges$i[1];
|
|
8912
|
+
|
|
8913
|
+
var countOfRows = endRowIndex - beginRowIndex + 1;
|
|
8914
|
+
newViewData.splice(beginRowIndex, countOfRows);
|
|
8915
|
+
}
|
|
8916
|
+
} // Apply filtering
|
|
8917
|
+
|
|
7836
8918
|
|
|
7837
8919
|
var _loop = function _loop() {
|
|
7838
8920
|
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i4], 2),
|
|
@@ -7867,8 +8949,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7867
8949
|
|
|
7868
8950
|
var collapsedGroups = [];
|
|
7869
8951
|
|
|
7870
|
-
for (var
|
|
7871
|
-
var rows = self.groupedRows[
|
|
8952
|
+
for (var _i5 = 0; _i5 < self.groupedRows.length; _i5++) {
|
|
8953
|
+
var rows = self.groupedRows[_i5];
|
|
7872
8954
|
|
|
7873
8955
|
for (var j = 0; j < rows.length; j++) {
|
|
7874
8956
|
var r = rows[j];
|
|
@@ -7885,17 +8967,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7885
8967
|
var newLen = 0;
|
|
7886
8968
|
var len = collapsedGroups.length;
|
|
7887
8969
|
|
|
7888
|
-
for (var
|
|
7889
|
-
var _r = collapsedGroups[
|
|
8970
|
+
for (var _i6 = 0; _i6 < len; _i6++) {
|
|
8971
|
+
var _r = collapsedGroups[_i6];
|
|
7890
8972
|
|
|
7891
|
-
if (
|
|
8973
|
+
if (_i6 === len - 1) {
|
|
7892
8974
|
collapsedGroups[newLen++] = _r;
|
|
7893
8975
|
break;
|
|
7894
8976
|
}
|
|
7895
8977
|
|
|
7896
8978
|
var to = _r[1];
|
|
7897
8979
|
|
|
7898
|
-
var _collapsedGroups = _slicedToArray(collapsedGroups[
|
|
8980
|
+
var _collapsedGroups = _slicedToArray(collapsedGroups[_i6 + 1], 2),
|
|
7899
8981
|
from2 = _collapsedGroups[0],
|
|
7900
8982
|
to2 = _collapsedGroups[1];
|
|
7901
8983
|
|
|
@@ -7904,8 +8986,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7904
8986
|
continue;
|
|
7905
8987
|
}
|
|
7906
8988
|
|
|
7907
|
-
collapsedGroups[
|
|
7908
|
-
if (to2 > to) collapsedGroups[
|
|
8989
|
+
collapsedGroups[_i6 + 1] = _r;
|
|
8990
|
+
if (to2 > to) collapsedGroups[_i6 + 1][1] = to2;
|
|
7909
8991
|
}
|
|
7910
8992
|
|
|
7911
8993
|
collapsedGroups = collapsedGroups.slice(0, newLen); //#endregion merge groups
|
|
@@ -8099,7 +9181,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
8099
9181
|
document.body.removeChild(self.controlInput);
|
|
8100
9182
|
}
|
|
8101
9183
|
|
|
8102
|
-
self.eventParent.removeEventListener('mouseup', self.mouseup, false);
|
|
8103
9184
|
self.eventParent.removeEventListener('mousedown', self.mousedown, false);
|
|
8104
9185
|
self.eventParent.removeEventListener('dblclick', self.dblclick, false);
|
|
8105
9186
|
self.eventParent.removeEventListener('click', self.click, false);
|
|
@@ -8113,7 +9194,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
8113
9194
|
self.controlInput.removeEventListener('keypress', self.keypress, false);
|
|
8114
9195
|
self.controlInput.removeEventListener('keyup', self.keyup, false);
|
|
8115
9196
|
self.controlInput.removeEventListener('keydown', self.keydown, false);
|
|
8116
|
-
|
|
9197
|
+
window.removeEventListener('mouseup', self.mouseup, false);
|
|
9198
|
+
window.removeEventListener('mousemove', self.mousemove);
|
|
8117
9199
|
window.removeEventListener('resize', self.resize);
|
|
8118
9200
|
|
|
8119
9201
|
if (self.observer && self.observer.disconnect) {
|
|
@@ -8707,6 +9789,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
8707
9789
|
self.intf.cut = self.cut;
|
|
8708
9790
|
self.intf.paste = self.paste;
|
|
8709
9791
|
self.intf.setStyleProperty = self.setStyleProperty;
|
|
9792
|
+
self.intf.hideColumns = self.hideColumns;
|
|
9793
|
+
self.intf.unhideColumns = self.unhideColumns;
|
|
9794
|
+
self.intf.hideRows = self.hideRows;
|
|
9795
|
+
self.intf.unhideRows = self.unhideRows;
|
|
8710
9796
|
Object.defineProperty(self.intf, 'defaults', {
|
|
8711
9797
|
get: function get() {
|
|
8712
9798
|
return {
|
|
@@ -9260,6 +10346,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9260
10346
|
self.cellGridAttributes = value;
|
|
9261
10347
|
}
|
|
9262
10348
|
});
|
|
10349
|
+
Object.defineProperty(self.intf, 'fillCellCallback', {
|
|
10350
|
+
get: function get() {
|
|
10351
|
+
return self.fillCellCallback;
|
|
10352
|
+
},
|
|
10353
|
+
set: function setFillCellCallback(value) {
|
|
10354
|
+
self.fillCellCallback = value;
|
|
10355
|
+
}
|
|
10356
|
+
});
|
|
9263
10357
|
Object.defineProperty(self.intf, 'ctx', {
|
|
9264
10358
|
get: function get() {
|
|
9265
10359
|
return self.ctx;
|
|
@@ -9701,7 +10795,7 @@ if (window && !window.canvasDatagrid && !window.require && // Present to exclude
|
|
|
9701
10795
|
function canvasDatagrid(args) {
|
|
9702
10796
|
args = args || {};
|
|
9703
10797
|
var i,
|
|
9704
|
-
tKeys = ['style', 'formatters', 'sorters', 'filters', 'treeGridAttributes', 'cellGridAttributes', 'data', 'schema'];
|
|
10798
|
+
tKeys = ['style', 'formatters', 'sorters', 'filters', 'treeGridAttributes', 'cellGridAttributes', 'fillCellCallback', 'data', 'schema'];
|
|
9705
10799
|
|
|
9706
10800
|
if (window.customElements) {
|
|
9707
10801
|
i = document.createElement('canvas-datagrid');
|
|
@@ -9770,7 +10864,7 @@ function canvasDatagrid(args) {
|
|
|
9770
10864
|
/*! namespace exports */
|
|
9771
10865
|
/*! export default [provided] [no usage info] [missing usage info prevents renaming] */
|
|
9772
10866
|
/*! other exports [not provided] [no usage info] */
|
|
9773
|
-
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
|
|
10867
|
+
/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
|
|
9774
10868
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9775
10869
|
|
|
9776
10870
|
"use strict";
|
|
@@ -9778,6 +10872,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9778
10872
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9779
10873
|
/* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
|
|
9780
10874
|
/* harmony export */ });
|
|
10875
|
+
/* harmony import */ var _groups_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./groups/util */ "./lib/groups/util.js");
|
|
9781
10876
|
/*jslint browser: true, unparam: true, todo: true*/
|
|
9782
10877
|
|
|
9783
10878
|
/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
|
|
@@ -9789,6 +10884,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
9789
10884
|
|
|
9790
10885
|
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; }
|
|
9791
10886
|
|
|
10887
|
+
|
|
9792
10888
|
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
|
|
9793
10889
|
/**
|
|
9794
10890
|
* Converts a integer into a letter A - ZZZZZ...
|
|
@@ -10228,6 +11324,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10228
11324
|
|
|
10229
11325
|
|
|
10230
11326
|
self.setActiveCell = function (x, y) {
|
|
11327
|
+
if (typeof x === 'undefined') return;
|
|
11328
|
+
|
|
10231
11329
|
if (x < 0) {
|
|
10232
11330
|
x = 0;
|
|
10233
11331
|
}
|
|
@@ -10252,6 +11350,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10252
11350
|
|
|
10253
11351
|
self.selectNone = function (dontDraw) {
|
|
10254
11352
|
self.selections = [];
|
|
11353
|
+
self.selectedRows = [];
|
|
11354
|
+
self.selectedColumns = [];
|
|
10255
11355
|
self.dispatchEvent('selectionchanged', {
|
|
10256
11356
|
selectedData: self.getSelectedData(),
|
|
10257
11357
|
selections: self.selections,
|
|
@@ -10289,51 +11389,42 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10289
11389
|
self.draw();
|
|
10290
11390
|
};
|
|
10291
11391
|
/**
|
|
10292
|
-
* Returns true if
|
|
11392
|
+
* Returns true if the selected columnIndex is selected on every row.
|
|
10293
11393
|
* @memberof canvasDatagrid
|
|
10294
|
-
* @name
|
|
11394
|
+
* @name isColumnSelected
|
|
10295
11395
|
* @method
|
|
10296
11396
|
* @param {number} columnIndex The column index to check.
|
|
10297
11397
|
*/
|
|
10298
11398
|
|
|
10299
11399
|
|
|
10300
|
-
self.
|
|
10301
|
-
var
|
|
11400
|
+
self.isColumnSelected = function (columnIndex) {
|
|
11401
|
+
var colIsSelected = true;
|
|
10302
11402
|
self.viewData.forEach(function (row, rowIndex) {
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
if (!columnIndices || columnIndices.length <= 1 || columnIndices.indexOf(columnIndex) === -1) {
|
|
10306
|
-
multiColIsSelected = false;
|
|
10307
|
-
} else if (columnIndices.length > 1) {
|
|
10308
|
-
if (columnIndices[0] != columnIndex) multiColIsSelected = false;else {
|
|
10309
|
-
for (var i = 0; i < columnIndices.length - 1; i++) {
|
|
10310
|
-
if (columnIndices[i] + 1 != columnIndices[i + 1]) {
|
|
10311
|
-
multiColIsSelected = false;
|
|
10312
|
-
break;
|
|
10313
|
-
}
|
|
10314
|
-
}
|
|
10315
|
-
}
|
|
11403
|
+
if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(columnIndex) === -1) {
|
|
11404
|
+
colIsSelected = false;
|
|
10316
11405
|
}
|
|
10317
11406
|
});
|
|
10318
|
-
return
|
|
11407
|
+
return colIsSelected;
|
|
10319
11408
|
};
|
|
10320
11409
|
/**
|
|
10321
|
-
* Returns true if the selected
|
|
11410
|
+
* Returns true if the selected rowIndex is selected on every column.
|
|
10322
11411
|
* @memberof canvasDatagrid
|
|
10323
|
-
* @name
|
|
11412
|
+
* @name isRowSelected
|
|
10324
11413
|
* @method
|
|
10325
|
-
* @param {number}
|
|
11414
|
+
* @param {number} rowIndex The row index to check.
|
|
10326
11415
|
*/
|
|
10327
11416
|
|
|
10328
11417
|
|
|
10329
|
-
self.
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
11418
|
+
self.isRowSelected = function (rowIndex) {
|
|
11419
|
+
if (!self.selections[rowIndex]) return false;
|
|
11420
|
+
var rowIsSelected = true;
|
|
11421
|
+
var schema = self.getVisibleSchema();
|
|
11422
|
+
schema.forEach(function (col, index) {
|
|
11423
|
+
if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(index) === -1) {
|
|
11424
|
+
rowIsSelected = false;
|
|
10334
11425
|
}
|
|
10335
11426
|
});
|
|
10336
|
-
return
|
|
11427
|
+
return rowIsSelected;
|
|
10337
11428
|
};
|
|
10338
11429
|
/**
|
|
10339
11430
|
* Runs the defined method on each selected cell.
|
|
@@ -10383,6 +11474,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10383
11474
|
|
|
10384
11475
|
self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {
|
|
10385
11476
|
var s, e, x;
|
|
11477
|
+
self.isMultiRowsSelected = false;
|
|
11478
|
+
self.isMultiColumnsSelected = false;
|
|
10386
11479
|
|
|
10387
11480
|
function addCol(i) {
|
|
10388
11481
|
self.viewData.forEach(function (row, rowIndex) {
|
|
@@ -10414,19 +11507,25 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10414
11507
|
|
|
10415
11508
|
for (x = s; e > x; x += 1) {
|
|
10416
11509
|
addCol(x);
|
|
11510
|
+
if (self.selectedColumns.indexOf(x) === -1) self.selectedColumns.push(x);
|
|
10417
11511
|
}
|
|
11512
|
+
|
|
11513
|
+
if (s != e) self.isMultiColumnsSelected = true;
|
|
10418
11514
|
}
|
|
10419
11515
|
|
|
10420
11516
|
if (!ctrl && !shift) {
|
|
10421
11517
|
self.selections = [];
|
|
11518
|
+
self.selectedColumns = [];
|
|
10422
11519
|
self.activeCell.columnIndex = columnIndex;
|
|
10423
11520
|
self.activeCell.rowIndex = self.scrollIndexTop;
|
|
10424
11521
|
}
|
|
10425
11522
|
|
|
10426
11523
|
if (ctrl && self.isColumnSelected(columnIndex)) {
|
|
10427
11524
|
removeCol(columnIndex);
|
|
11525
|
+
self.selectedColumns.splice(columnIndex, 1);
|
|
10428
11526
|
} else {
|
|
10429
11527
|
addCol(columnIndex);
|
|
11528
|
+
self.selectedColumns.push(columnIndex);
|
|
10430
11529
|
}
|
|
10431
11530
|
|
|
10432
11531
|
if (supressEvent) {
|
|
@@ -10477,6 +11576,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10477
11576
|
self.selections[ri].push(-1);
|
|
10478
11577
|
s.forEach(function (col, index) {
|
|
10479
11578
|
self.selections[ri].push(self.orders.columns.indexOf(col.index));
|
|
11579
|
+
if (col.index !== -1 && self.selectedColumns.indexOf(self.orders.columns.indexOf(col.index)) === -1) self.selectedColumns.push(self.orders.columns.indexOf(col.index));
|
|
10480
11580
|
});
|
|
10481
11581
|
}
|
|
10482
11582
|
|
|
@@ -10501,9 +11601,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10501
11601
|
|
|
10502
11602
|
for (x = st; en >= x; x += 1) {
|
|
10503
11603
|
addRow(x);
|
|
11604
|
+
self.selectedRows.push(x);
|
|
10504
11605
|
}
|
|
10505
11606
|
} else {
|
|
10506
11607
|
addRow(rowIndex);
|
|
11608
|
+
self.selectedRows = [];
|
|
11609
|
+
self.selectedRows.push(rowIndex);
|
|
10507
11610
|
}
|
|
10508
11611
|
}
|
|
10509
11612
|
|
|
@@ -10627,6 +11730,102 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10627
11730
|
}
|
|
10628
11731
|
}
|
|
10629
11732
|
};
|
|
11733
|
+
/**
|
|
11734
|
+
* Hide column/columns
|
|
11735
|
+
* @memberof canvasDatagrid
|
|
11736
|
+
* @name hideColumns
|
|
11737
|
+
* @method
|
|
11738
|
+
* @param {number} beginColumnOrderIndex The begin column order index
|
|
11739
|
+
* @param {number} [endColumnOrderIndex] The end column order index
|
|
11740
|
+
*/
|
|
11741
|
+
|
|
11742
|
+
|
|
11743
|
+
self.hideColumns = function (beginColumnOrderIndex, endColumnOrderIndex) {
|
|
11744
|
+
var schema = self.getSchema();
|
|
11745
|
+
var orders = self.orders.columns;
|
|
11746
|
+
var hiddenColumns = [];
|
|
11747
|
+
if (typeof endColumnOrderIndex !== 'number') endColumnOrderIndex = beginColumnOrderIndex;
|
|
11748
|
+
|
|
11749
|
+
for (var orderIndex = beginColumnOrderIndex; orderIndex <= endColumnOrderIndex; orderIndex++) {
|
|
11750
|
+
var columnIndex = orders[orderIndex];
|
|
11751
|
+
|
|
11752
|
+
if (columnIndex >= 0 && !schema[columnIndex].hidden) {
|
|
11753
|
+
hiddenColumns.push(columnIndex);
|
|
11754
|
+
schema[columnIndex].hidden = true;
|
|
11755
|
+
self.dispatchEvent('columnhide', {
|
|
11756
|
+
columnIndex: columnIndex
|
|
11757
|
+
});
|
|
11758
|
+
}
|
|
11759
|
+
}
|
|
11760
|
+
|
|
11761
|
+
if (hiddenColumns.length > 0) {
|
|
11762
|
+
self.setStorageData();
|
|
11763
|
+
setTimeout(function () {
|
|
11764
|
+
self.resize(true);
|
|
11765
|
+
}, 10);
|
|
11766
|
+
}
|
|
11767
|
+
|
|
11768
|
+
self.dispatchEvent('hidecolumns', {
|
|
11769
|
+
hiddenColumns: hiddenColumns
|
|
11770
|
+
});
|
|
11771
|
+
};
|
|
11772
|
+
/**
|
|
11773
|
+
* Unihde column/columns
|
|
11774
|
+
* @memberof canvasDatagrid
|
|
11775
|
+
* @name unhideColumns
|
|
11776
|
+
* @method
|
|
11777
|
+
* @param {number} beginColumnOrderIndex The begin column order index
|
|
11778
|
+
* @param {number} [endColumnOrderIndex] The end column order index
|
|
11779
|
+
*/
|
|
11780
|
+
|
|
11781
|
+
|
|
11782
|
+
self.unhideColumns = function (beginColumnOrderIndex, endColumnOrderIndex) {
|
|
11783
|
+
var orders = self.orders.columns;
|
|
11784
|
+
var schema = self.getSchema();
|
|
11785
|
+
|
|
11786
|
+
for (var i = beginColumnOrderIndex; i <= endColumnOrderIndex; i++) {
|
|
11787
|
+
var columnIndex = orders[i];
|
|
11788
|
+
var s = schema[columnIndex];
|
|
11789
|
+
|
|
11790
|
+
if (s && s.hidden) {
|
|
11791
|
+
s.hidden = false;
|
|
11792
|
+
self.dispatchEvent('columnunhide', {
|
|
11793
|
+
columnIndex: columnIndex
|
|
11794
|
+
});
|
|
11795
|
+
}
|
|
11796
|
+
}
|
|
11797
|
+
|
|
11798
|
+
self.refresh();
|
|
11799
|
+
};
|
|
11800
|
+
/**
|
|
11801
|
+
* Hide rows
|
|
11802
|
+
* @memberof canvasDatagrid
|
|
11803
|
+
* @name hideRows
|
|
11804
|
+
* @method
|
|
11805
|
+
* @param {number} beginRowIndex The begin row index
|
|
11806
|
+
* @param {number} endRowIndex The end row index
|
|
11807
|
+
*/
|
|
11808
|
+
|
|
11809
|
+
|
|
11810
|
+
self.hideRows = function (beginRowIndex, endRowIndex) {
|
|
11811
|
+
if ((0,_groups_util__WEBPACK_IMPORTED_MODULE_0__.mergeHiddenRowRanges)(self.hiddenRowRanges, [beginRowIndex, endRowIndex])) self.refresh();
|
|
11812
|
+
};
|
|
11813
|
+
/**
|
|
11814
|
+
* Unhide rows
|
|
11815
|
+
* @memberof canvasDatagrid
|
|
11816
|
+
* @name unhideRows
|
|
11817
|
+
* @method
|
|
11818
|
+
* @param {number} beginRowIndex The begin row index
|
|
11819
|
+
* @param {number} endRowIndex The end row index
|
|
11820
|
+
*/
|
|
11821
|
+
|
|
11822
|
+
|
|
11823
|
+
self.unhideRows = function (beginRowIndex, endRowIndex) {
|
|
11824
|
+
self.hiddenRowRanges = self.hiddenRowRanges.filter(function (range) {
|
|
11825
|
+
return range[0] !== beginRowIndex || range[1] !== endRowIndex;
|
|
11826
|
+
});
|
|
11827
|
+
self.refresh();
|
|
11828
|
+
};
|
|
10630
11829
|
/**
|
|
10631
11830
|
* Resizes a column to fit the longest value in the column. Call without a value to resize all columns.
|
|
10632
11831
|
* Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).
|
|
@@ -10745,6 +11944,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10745
11944
|
/**
|
|
10746
11945
|
* Add grouping
|
|
10747
11946
|
* @param {'columns'|'rows'} groupFor
|
|
11947
|
+
* @method
|
|
10748
11948
|
* @param {number} from
|
|
10749
11949
|
* @param {number} to
|
|
10750
11950
|
*/
|
|
@@ -10836,6 +12036,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
10836
12036
|
/**
|
|
10837
12037
|
* Remove grouping
|
|
10838
12038
|
* @param {Array<Array<{from:number,to:number,collapsed:boolean}>>} allGroups
|
|
12039
|
+
* @method
|
|
10839
12040
|
* @param {number} from
|
|
10840
12041
|
* @param {number} to
|
|
10841
12042
|
*/
|
|
@@ -11071,10 +12272,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11071
12272
|
|
|
11072
12273
|
self.moveSelection = function (offsetX, offsetY) {
|
|
11073
12274
|
var sel = [];
|
|
12275
|
+
self.selectedRows = [];
|
|
12276
|
+
self.selectedColumns = [];
|
|
11074
12277
|
self.selections.forEach(function (row, rowIndex) {
|
|
11075
12278
|
sel[rowIndex + offsetY] = [];
|
|
12279
|
+
self.selectedRows.push(rowIndex + offsetY);
|
|
11076
12280
|
row.forEach(function (colIndex) {
|
|
11077
12281
|
sel[rowIndex + offsetY].push(colIndex + offsetX);
|
|
12282
|
+
if (self.selectedColumns.indexOf(colIndex + offsetX) === -1) self.selectedColumns.push(colIndex + offsetX);
|
|
11078
12283
|
});
|
|
11079
12284
|
});
|
|
11080
12285
|
self.selections = sel;
|
|
@@ -11287,6 +12492,25 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11287
12492
|
return c.columnIndex === x && c.rowIndex === y;
|
|
11288
12493
|
})[0];
|
|
11289
12494
|
};
|
|
12495
|
+
/**
|
|
12496
|
+
* Get an unhide indicator at grid pixel coordinate x and y.
|
|
12497
|
+
* @memberof canvasDatagrid
|
|
12498
|
+
* @name getUnhideIndicator
|
|
12499
|
+
* @method
|
|
12500
|
+
* @param {number} x Number of pixels from the left.
|
|
12501
|
+
* @param {number} y Number of pixels from the top.
|
|
12502
|
+
*/
|
|
12503
|
+
|
|
12504
|
+
|
|
12505
|
+
self.getUnhideIndicator = function (x, y) {
|
|
12506
|
+
var indicators = self.visibleUnhideIndicators;
|
|
12507
|
+
if (indicators.length <= 0) return;
|
|
12508
|
+
|
|
12509
|
+
for (var i = 0; i < indicators.length; i++) {
|
|
12510
|
+
var indicator = indicators[i];
|
|
12511
|
+
if (x >= indicator.x && y >= indicator.y && x <= indicator.x2 && y <= indicator.y2) return indicator;
|
|
12512
|
+
}
|
|
12513
|
+
};
|
|
11290
12514
|
/**
|
|
11291
12515
|
* Get a column group at grid pixel coordinate x and y.
|
|
11292
12516
|
* @memberof canvasDatagrid
|
|
@@ -11367,6 +12591,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11367
12591
|
|
|
11368
12592
|
x -= self.getRowGroupAreaWidth();
|
|
11369
12593
|
y -= self.getColumnGroupAreaHeight();
|
|
12594
|
+
|
|
12595
|
+
if (self.dragStartObject !== undefined) {
|
|
12596
|
+
if (x <= 0) x = 1;
|
|
12597
|
+
if (x >= self.width) x = self.width - 1;
|
|
12598
|
+
if (y <= 0) y = 1;
|
|
12599
|
+
if (y >= self.height) y = self.height - 1;
|
|
12600
|
+
}
|
|
12601
|
+
|
|
11370
12602
|
var border,
|
|
11371
12603
|
tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0,
|
|
11372
12604
|
moveMode = self.attributes.borderDragBehavior === 'move',
|
|
@@ -11411,14 +12643,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11411
12643
|
|
|
11412
12644
|
if (entitiy.x - self.style.cellBorderWidth < x && entitiy.x + entitiy.width + self.style.cellBorderWidth > x && entitiy.y - self.style.cellBorderWidth < y && entitiy.y + entitiy.height + self.style.cellBorderWidth > y) {
|
|
11413
12645
|
if (/frozen-row-marker/.test(cell.style)) {
|
|
12646
|
+
if (self.dragMode === 'frozen-column-marker') continue;
|
|
11414
12647
|
cell.dragContext = cell.style;
|
|
11415
|
-
cell.context = '
|
|
12648
|
+
cell.context = 'grab';
|
|
11416
12649
|
return cell;
|
|
11417
12650
|
}
|
|
11418
12651
|
|
|
11419
12652
|
if (/frozen-column-marker/.test(cell.style)) {
|
|
12653
|
+
if (self.dragMode === 'frozen-row-marker') continue;
|
|
11420
12654
|
cell.dragContext = cell.style;
|
|
11421
|
-
cell.context = '
|
|
12655
|
+
cell.context = 'grab';
|
|
11422
12656
|
return cell;
|
|
11423
12657
|
}
|
|
11424
12658
|
|
|
@@ -11497,7 +12731,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11497
12731
|
}
|
|
11498
12732
|
|
|
11499
12733
|
if (cell.style === 'columnHeaderCell') {
|
|
11500
|
-
if (cell.x + cell.width - self.attributes.columnGrabZoneSize - self.style.cellBorderWidth > x || !self.attributes.allowRowReordering) {
|
|
12734
|
+
if (!self.isColumnSelected(cell.columnIndex) && cell.x + cell.width - self.attributes.columnGrabZoneSize - self.style.cellBorderWidth > x || !self.attributes.allowRowReordering) {
|
|
11501
12735
|
cell.dragContext = 'cell';
|
|
11502
12736
|
cell.context = 'cell';
|
|
11503
12737
|
} else {
|
|
@@ -11509,7 +12743,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11509
12743
|
}
|
|
11510
12744
|
|
|
11511
12745
|
if (cell.style === 'rowHeaderCell') {
|
|
11512
|
-
if (self.attributes.rowGrabZoneSize + (cell.y - self.style.cellBorderWidth) < y || !self.attributes.allowRowReordering) {
|
|
12746
|
+
if (!self.isRowSelected(cell.rowIndex) && self.attributes.rowGrabZoneSize + (cell.y - self.style.cellBorderWidth) < y || !self.attributes.allowRowReordering) {
|
|
11513
12747
|
cell.dragContext = 'cell';
|
|
11514
12748
|
cell.context = 'cell';
|
|
11515
12749
|
} else {
|
|
@@ -11646,6 +12880,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11646
12880
|
|
|
11647
12881
|
if (!ctrl) {
|
|
11648
12882
|
self.selections = [];
|
|
12883
|
+
self.selectedRows = [];
|
|
12884
|
+
self.selectedColumns = [];
|
|
11649
12885
|
}
|
|
11650
12886
|
|
|
11651
12887
|
if (self.selectionBounds.top < -1 || self.selectionBounds.bottom > self.viewData.length || self.selectionBounds.left < -1 || self.selectionBounds.right > s.length) {
|
|
@@ -11654,11 +12890,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11654
12890
|
|
|
11655
12891
|
for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {
|
|
11656
12892
|
self.selections[x] = [];
|
|
12893
|
+
self.selectedRows.push(x);
|
|
11657
12894
|
|
|
11658
12895
|
for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {
|
|
11659
12896
|
if (self.selections[x].indexOf(y) === -1) {
|
|
11660
12897
|
self.selections[x].push(y);
|
|
11661
12898
|
}
|
|
12899
|
+
|
|
12900
|
+
if (y !== -1 && self.selectedColumns.indexOf(y) === -1) {
|
|
12901
|
+
self.selectedColumns.push(y);
|
|
12902
|
+
}
|
|
11662
12903
|
}
|
|
11663
12904
|
}
|
|
11664
12905
|
|
|
@@ -11699,7 +12940,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11699
12940
|
}
|
|
11700
12941
|
|
|
11701
12942
|
self.ctx.font = self.style.columnHeaderCellFont;
|
|
11702
|
-
var t = self.ctx.measureText(col.title || col.name).width + self.style.
|
|
12943
|
+
var t = self.ctx.measureText(col.title || col.name).width + self.style.columnHeaderCellPaddingRight + self.style.columnHeaderCellPaddingLeft + self.style.cellAutoResizePadding;
|
|
11703
12944
|
m = t > m ? t : m;
|
|
11704
12945
|
formatter = self.formatters[col.type];
|
|
11705
12946
|
});
|